From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH] crypto: Always initialize splitkeylen
Date: Fri, 26 May 2023 11:37:03 +0100 [thread overview]
Message-ID: <ZHCLz47myVu/h7uk@redhat.com> (raw)
In-Reply-To: <20230522114737.32686-1-akihiko.odaki@daynix.com>
On Mon, May 22, 2023 at 08:47:37PM +0900, Akihiko Odaki wrote:
> When _FORTIFY_SOURCE=2, glibc version is 2.35, and GCC version is
> 12.1.0, the compiler complains as follows:
>
> In file included from /usr/include/string.h:535,
> from /home/alarm/q/var/qemu/include/qemu/osdep.h:99,
> from ../crypto/block-luks.c:21:
> In function 'memset',
> inlined from 'qcrypto_block_luks_store_key' at ../crypto/block-luks.c:843:9:
> /usr/include/bits/string_fortified.h:59:10: error: 'splitkeylen' may be used uninitialized [-Werror=maybe-uninitialized]
> 59 | return __builtin___memset_chk (__dest, __ch, __len,
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 60 | __glibc_objsize0 (__dest));
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../crypto/block-luks.c: In function 'qcrypto_block_luks_store_key':
> ../crypto/block-luks.c:699:12: note: 'splitkeylen' was declared here
> 699 | size_t splitkeylen;
> | ^~~~~~~~~~~
>
> It seems the compiler cannot see that splitkeylen will not be used
> when splitkey is NULL. Suppress the warning by initializing splitkeylen
> even when splitkey stays NULL.
>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
> crypto/block-luks.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
and queued.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
prev parent reply other threads:[~2023-05-26 10:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-22 11:47 [PATCH] crypto: Always initialize splitkeylen Akihiko Odaki
2023-05-22 12:35 ` Philippe Mathieu-Daudé
2023-05-22 13:08 ` Akihiko Odaki
2023-05-26 10:37 ` Daniel P. Berrangé [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=ZHCLz47myVu/h7uk@redhat.com \
--to=berrange@redhat.com \
--cc=akihiko.odaki@daynix.com \
--cc=qemu-devel@nongnu.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 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).