Whamcloud - gitweb
LU-16518 lod: fix new clang error in lod_lov.c 66/52566/5
authorTimothy Day <timday@amazon.com>
Tue, 3 Oct 2023 15:59:30 +0000 (15:59 +0000)
committerOleg Drokin <green@whamcloud.com>
Sat, 18 Nov 2023 21:44:45 +0000 (21:44 +0000)
The variable hsmsize was uninitialized in some
situations. By moving the initialization earlier,
we can avoid this.

Fixes: aebb405e32e ("LU-10499 pcc: use foreign layout for PCCRO")
Signed-off-by: Timothy Day <timday@amazon.com>
Change-Id: I3385e3349ad00d037b8b94337cb3352623d0a40a
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52566
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Qian Yingjin <qian@ddn.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/lod/lod_lov.c

index e99082f..3787656 100644 (file)
@@ -2267,6 +2267,8 @@ recheck:
                        }
 
                        lhm = (struct lov_hsm_md *)lfm;
+                       hsmsize = lov_foreign_size_le(lhm);
+
                        if (le32_to_cpu(lhm->lhm_length) !=
                            sizeof(struct lov_hsm_base)) {
                                CDEBUG(D_LAYOUT,
@@ -2275,7 +2277,6 @@ recheck:
                                RETURN(-EINVAL);
                        }
 
-                       hsmsize = lov_foreign_size_le(lhm);
                        if (le32_to_cpu(ent->lcme_size) < hsmsize) {
                                CDEBUG(D_LAYOUT,
                                       "Invalid HSM component size %u != %u\n",