From: Bob Glossman Date: Wed, 14 Nov 2012 20:43:59 +0000 (-0800) Subject: LU-2273 tests: test failure on lustre-rsync-test X-Git-Tag: 2.3.57~18 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=7c6ba5c87cfacbb615a82d587509975e96b69da5;p=fs%2Flustre-release.git LU-2273 tests: test failure on lustre-rsync-test One off allocation errors in lustre_rsync test program cause corruption of malloc arena and program faults. Test-Parameters: clientdistro=sles11sp2 \ envdefinitions=SANITY_EXCEPT=39l,CONF_SANITY_EXCEPT=32b Signed-off-by: Bob Glossman Change-Id: If347bedcac7d843560b5e215cf09002316ae7b47 Reviewed-on: http://review.whamcloud.com/4583 Tested-by: Hudson Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Keith Mannthey --- diff --git a/lustre/utils/lustre_rsync.c b/lustre/utils/lustre_rsync.c index 2e50a87..b5cde93 100644 --- a/lustre/utils/lustre_rsync.c +++ b/lustre/utils/lustre_rsync.c @@ -1138,7 +1138,7 @@ int lr_parse_line(void *priv, struct lr_info *info) /* Initialize the replication parameters */ int lr_init_status() { - size_t size = sizeof(struct lustre_rsync_status) + PATH_MAX; + size_t size = sizeof(struct lustre_rsync_status) + PATH_MAX + 1; if (status != NULL) return 0; @@ -1217,7 +1217,7 @@ int lr_read_log() struct lustre_rsync_status *s; int fd = -1; size_t size; - size_t read_size = sizeof(struct lustre_rsync_status) + PATH_MAX; + size_t read_size = sizeof(struct lustre_rsync_status) + PATH_MAX + 1; int rc = 0; if (statuslog == NULL) @@ -1264,7 +1264,7 @@ int lr_read_log() } status->ls_num_targets = s->ls_num_targets; memcpy(status->ls_targets, s->ls_targets, - PATH_MAX * s->ls_num_targets); + (PATH_MAX + 1) * s->ls_num_targets); } if (status->ls_last_recno == -1) status->ls_last_recno = s->ls_last_recno; @@ -1604,7 +1604,7 @@ int main(int argc, char *argv[]) status->ls_num_targets = numtargets; } newsize = sizeof (struct lustre_rsync_status) + - (status->ls_num_targets * PATH_MAX); + (status->ls_num_targets * (PATH_MAX + 1)); if (status->ls_size != newsize) { status->ls_size = newsize; status = lr_grow_buf(status, newsize);