From: Sebastien Buisson Date: Wed, 2 Oct 2013 08:48:09 +0000 (+0200) Subject: LU-4046 build: fix 'uninitialized variables' errors X-Git-Tag: 2.5.51~53 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=995e7a6f02354d3fe5b5a6faae71cc4975f0c212;hp=22e45ed08068b2ecf479cf4d0d294fa471126b0c;p=fs%2Flustre-release.git LU-4046 build: fix 'uninitialized variables' errors Fix 'uninitialized variables' defects found by Coverity version 6.5.1: Uninitialized scalar variable (UNINIT) Using uninitialized value. Signed-off-by: Sebastien Buisson Change-Id: I4b5a3293e7d01436a82b6f7cea50b84c60660b3a Reviewed-on: http://review.whamcloud.com/7821 Tested-by: Hudson Reviewed-by: jacques-Charles Lafoucriere Tested-by: Maloo Reviewed-by: Emoly Liu Reviewed-by: Oleg Drokin --- diff --git a/lustre/lfsck/lfsck_namespace.c b/lustre/lfsck/lfsck_namespace.c index 5eb8cee..3cc043d 100644 --- a/lustre/lfsck/lfsck_namespace.c +++ b/lustre/lfsck/lfsck_namespace.c @@ -1368,7 +1368,7 @@ static int lfsck_namespace_double_scan(const struct lu_env *env, struct dt_key *key; struct lu_fid fid; int rc; - __u8 flags; + __u8 flags = 0; ENTRY; lfsck->li_new_scanned = 0; diff --git a/lustre/utils/lhsmtool_posix.c b/lustre/utils/lhsmtool_posix.c index 60077d8..06bf004 100644 --- a/lustre/utils/lhsmtool_posix.c +++ b/lustre/utils/lhsmtool_posix.c @@ -542,15 +542,6 @@ static int ct_copy_data(struct hsm_copyaction_private *hcp, const char *src, return rc; } - rc = lseek(src_fd, hai->hai_extent.offset, SEEK_SET); - if (rc < 0) { - CT_ERROR(errno, - "cannot seek for read to "LPU64" (len %jd) in '%s'", - hai->hai_extent.offset, (intmax_t)src_st.st_size, src); - rc = -errno; - goto out; - } - if (fstat(dst_fd, &dst_st) < 0) { CT_ERROR(errno, "cannot stat '%s'", dst); return -errno; @@ -562,6 +553,15 @@ static int ct_copy_data(struct hsm_copyaction_private *hcp, const char *src, return rc; } + rc = lseek(src_fd, hai->hai_extent.offset, SEEK_SET); + if (rc < 0) { + CT_ERROR(errno, + "cannot seek for read to "LPU64" (len %jd) in '%s'", + hai->hai_extent.offset, (intmax_t)src_st.st_size, src); + rc = -errno; + goto out; + } + rc = lseek(dst_fd, hai->hai_extent.offset, SEEK_SET); if (rc < 0) { rc = -errno; @@ -858,7 +858,7 @@ static int ct_archive(const struct hsm_action_item *hai, const long hal_flags) { struct hsm_copyaction_private *hcp = NULL; char src[PATH_MAX]; - char dst[PATH_MAX]; + char dst[PATH_MAX] = ""; int rc; int rcf = 0; bool rename_needed = false;