From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Fam Zheng <fam@euphon.net>, Kevin Wolf <kwolf@redhat.com>,
qemu-block@nongnu.org, qemu-devel@nongnu.org,
Max Reitz <mreitz@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [PATCH 4/4] virtiofsd: avoid false positive compiler warning
Date: Wed, 30 Sep 2020 17:27:57 +0100 [thread overview]
Message-ID: <20200930162757.GD2783@work-vm> (raw)
In-Reply-To: <20200930155859.303148-5-borntraeger@de.ibm.com>
* Christian Borntraeger (borntraeger@de.ibm.com) wrote:
> make: *** [Makefile:121: config-host.mak] Error 1
> [cborntra@m83lp52 qemu]$ make -C build/
> make: Entering directory '/home/cborntra/REPOS/qemu/build'
> Generating qemu-version.h with a meson_exe.py custom command
> Compiling C object tools/virtiofsd/virtiofsd.p/passthrough_ll.c.o
> ../tools/virtiofsd/passthrough_ll.c: In function ‘lo_setattr’:
> ../tools/virtiofsd/passthrough_ll.c:702:19: error: ‘fd’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 702 | res = futimens(fd, tv);
> | ^~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> make: *** [Makefile.ninja:1438: tools/virtiofsd/virtiofsd.p/passthrough_ll.c.o] Error 1
> make: Leaving directory '/home/cborntra/REPOS/
>
> as far as I can see this can not happen. Let us silence the warning by
> giving fd a default value.
>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Yeh, I'd posted https://www.mail-archive.com/qemu-devel@nongnu.org/msg738783.html
but not yet merged it; only difference is I'd used -1 since it seemd
safer to use -1 even if it couldn't happen :-)
Dave
> ---
> tools/virtiofsd/passthrough_ll.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
> index 0b229ebd5786..da06aa6e9264 100644
> --- a/tools/virtiofsd/passthrough_ll.c
> +++ b/tools/virtiofsd/passthrough_ll.c
> @@ -620,7 +620,7 @@ static void lo_setattr(fuse_req_t req, fuse_ino_t ino, struct stat *attr,
> struct lo_inode *inode;
> int ifd;
> int res;
> - int fd;
> + int fd = 0;
>
> inode = lo_inode(req, ino);
> if (!inode) {
> --
> 2.26.2
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2020-09-30 16:33 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-30 15:58 [PATCH 0/4] assorted gcc 10/fedora32 compile warning fixes Christian Borntraeger
2020-09-30 15:58 ` [PATCH 1/4] vmdk: fix maybe uninitialized warnings Christian Borntraeger
2020-09-30 16:36 ` Fam Zheng
2020-10-05 6:26 ` Christian Borntraeger
2020-10-12 14:16 ` Laurent Vivier
2020-09-30 15:58 ` [PATCH 2/4] nbd: silence maybe-uninitialized warnings Christian Borntraeger
2020-09-30 17:19 ` Eric Blake
2020-10-05 6:25 ` Christian Borntraeger
2020-09-30 15:58 ` [PATCH 3/4] qemu-io-cmds: avoid gcc 10 warning Christian Borntraeger
2020-09-30 16:24 ` Dr. David Alan Gilbert
2020-09-30 16:25 ` Philippe Mathieu-Daudé
2020-09-30 15:58 ` [PATCH 4/4] virtiofsd: avoid false positive compiler warning Christian Borntraeger
2020-09-30 16:27 ` Dr. David Alan Gilbert [this message]
2020-10-05 6:25 ` Christian Borntraeger
2020-09-30 18:12 ` [PATCH 0/4] assorted gcc 10/fedora32 compile warning fixes no-reply
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=20200930162757.GD2783@work-vm \
--to=dgilbert@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=fam@euphon.net \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).