From 4505225108378433e878d137cc86723aab6be0f3 Mon Sep 17 00:00:00 2001 From: Timothy Day Date: Tue, 3 Oct 2023 15:59:30 +0000 Subject: [PATCH] LU-16518 lod: fix new clang error in lod_lov.c 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 Change-Id: I3385e3349ad00d037b8b94337cb3352623d0a40a Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52566 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin Reviewed-by: Qian Yingjin Reviewed-by: Arshad Hussain Reviewed-by: Andreas Dilger --- lustre/lod/lod_lov.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lustre/lod/lod_lov.c b/lustre/lod/lod_lov.c index e99082f..3787656 100644 --- a/lustre/lod/lod_lov.c +++ b/lustre/lod/lod_lov.c @@ -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", -- 1.8.3.1