From: hxing Date: Tue, 17 Oct 2023 07:20:12 +0000 (+0800) Subject: LU-17084 lod: fix comparision in lod_striping_load() X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=c22322cede6186b39e617d7a0ecfef3c41e0d1c5;p=fs%2Flustre-release.git LU-17084 lod: fix comparision in lod_striping_load() in if (rc > sizeof(struct lmv_foreign_md)) the latter is unsigned and gcc treats rc (which is defined as int and can be negative to encode an error) as unsigned. this way -EIO becomes greater than the size of the structure. make sizeof() signed to avoid confusion. Lustre-change: https://review.whamcloud.com/52265 Lustre-commit: ce54b5281c3172401ce4526a4de65d2d584fa0e7 Signed-off-by: Alex Zhuravlev Signed-off-by: Xing Huang Change-Id: Ie6735578649e397ed05b6951fab941f97051305b Reviewed-by: xinliang Reviewed-by: Mikhail Pershin Reviewed-by: Neil Brown Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/52721 Reviewed-by: Andreas Dilger Tested-by: jenkins Tested-by: Maloo --- diff --git a/lustre/lod/lod_lov.c b/lustre/lod/lod_lov.c index 29400d9..22bc06c 100644 --- a/lustre/lod/lod_lov.c +++ b/lustre/lod/lod_lov.c @@ -1652,7 +1652,8 @@ int lod_striping_load(const struct lu_env *env, struct lod_object *lo) lo->ldo_comp_cached = 1; } else if (S_ISDIR(lod2lu_obj(lo)->lo_header->loh_attr)) { rc = lod_get_lmv_ea(env, lo); - if (rc > sizeof(struct lmv_foreign_md)) { + + if (rc > (int)sizeof(struct lmv_foreign_md)) { struct lmv_foreign_md *lfm = info->lti_ea_store; if (le32_to_cpu(lfm->lfm_magic) == LMV_MAGIC_FOREIGN) {