From: Brian Foster <bfoster@redhat.com>
To: Luis Chamberlain <mcgrof@kernel.org>
Cc: fstests@vger.kernel.org, kaixuxia <kaixuxia@tencent.com>
Subject: Re: [PATCH] fsstress: fix bogus compile warning do_renameat2()
Date: Wed, 22 Sep 2021 13:24:24 -0400 [thread overview]
Message-ID: <YUtmyFtlOCT09dG3@bfoster> (raw)
In-Reply-To: <20210921175059.1287420-1-mcgrof@kernel.org>
On Tue, Sep 21, 2021 at 10:50:59AM -0700, Luis Chamberlain wrote:
> 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.
>
https://www.urbandictionary.com/define.php?term=shup
Huh. :P
> Cc: kaixuxia <kaixuxia@tencent.com>
> Cc: Brian Foster <bfoster@redhat.com>
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
> ---
Reviewed-by: Brian Foster <bfoster@redhat.com>
> ltp/fsstress.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/ltp/fsstress.c b/ltp/fsstress.c
> index d2f09901..0d620d7b 100644
> --- a/ltp/fsstress.c
> +++ b/ltp/fsstress.c
> @@ -4517,9 +4517,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;
> --
> 2.30.2
>
prev parent reply other threads:[~2021-09-22 17:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-21 17:50 [PATCH] fsstress: fix bogus compile warning do_renameat2() Luis Chamberlain
2021-09-22 17:24 ` Brian Foster [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YUtmyFtlOCT09dG3@bfoster \
--to=bfoster@redhat.com \
--cc=fstests@vger.kernel.org \
--cc=kaixuxia@tencent.com \
--cc=mcgrof@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.