From: Luis Chamberlain Date: Tue, 21 Sep 2021 17:50:59 +0000 (-0700) Subject: fsstress: fix bogus compile warning do_renameat2() X-Git-Tag: v2022.05.01~232 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=91b2c035346baa961b9c576036ed5800599cbac3;p=xfstests-dev.git fsstress: fix bogus compile warning do_renameat2() gcc complains with: fsstress.c:4629:4: warning: 'oldparid' may be used uninitialized in this function [-Wmaybe-uninitialized] 4629 | printf("%d/%d: rename source entry: id=%d,parent=%d\n", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4630 | procid, opno, oldid, oldparid); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fsstress.c:4629:4: warning: 'oldid' may be used uninitialized in this function [-Wmaybe-uninitialized] But the varaibles are sure to be initialized, it is just that the heuristics are broken since another check is used later which confuses gcc. So just initialize the variables, to shup the compile warning. Cc: kaixuxia Cc: Brian Foster Signed-off-by: Luis Chamberlain Reviewed-by: Brian Foster Signed-off-by: Eryu Guan --- diff --git a/ltp/fsstress.c b/ltp/fsstress.c index b4ddf5e2..90ae432e 100644 --- a/ltp/fsstress.c +++ b/ltp/fsstress.c @@ -4504,9 +4504,9 @@ do_renameat2(int opno, long r, int mode) flist_t *flp; int id; pathname_t newf; - int oldid; + int oldid = 0; int parid; - int oldparid; + int oldparid = 0; int which; int v; int v1;