From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Daniel Xu <dxu@dxuuu.xyz>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH v3 1/4] crypto/luks: Initialize stack variable to silence warning
Date: Wed, 1 Mar 2023 08:53:35 +0000 [thread overview]
Message-ID: <Y/8Sj18rm+VvbEP2@redhat.com> (raw)
In-Reply-To: <7d55ac8f0d021d39809298cac2f13f3826c284c8.1677617035.git.dxu@dxuuu.xyz>
On Tue, Feb 28, 2023 at 01:48:01PM -0700, Daniel Xu wrote:
> With `../configure --enable-sanitizers`, I was getting the following
> build error:
>
> In file included from /usr/include/string.h:535,
> from /home/dxu/dev/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;
> | ^~~~~~~~~~~
> cc1: all warnings being treated as errors
>
> The function is actually correct -- in the cleanup branch `splitkeylen`
> usage is guarded by checking `splitkey` nullness. But the compiler is
> not smart enough to realize that.
>
> Fix warning by initializing the variable.
>
> Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
> ---
> crypto/block-luks.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
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 :|
next prev parent reply other threads:[~2023-03-01 8:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-28 20:48 [PATCH v3 0/4] qga: Add optional `merge-output` flag to guest-exec QAPI Daniel Xu
2023-02-28 20:48 ` [PATCH v3 1/4] crypto/luks: Initialize stack variable to silence warning Daniel Xu
2023-03-01 8:53 ` Daniel P. Berrangé [this message]
2023-02-28 20:48 ` [PATCH v3 2/4] qemu-keymap: Fix memory leaks Daniel Xu
2023-03-01 7:34 ` Marc-André Lureau
2023-02-28 20:48 ` [PATCH v3 3/4] qga: Add optional `merge-output` flag to guest-exec qapi Daniel Xu
2023-03-01 9:03 ` Daniel P. Berrangé
2023-03-01 16:00 ` Daniel Xu
2023-02-28 20:48 ` [PATCH v3 4/4] qga: test: Add tests for `merge-output` flag Daniel Xu
2023-03-01 9:07 ` Daniel P. Berrangé
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=Y/8Sj18rm+VvbEP2@redhat.com \
--to=berrange@redhat.com \
--cc=dxu@dxuuu.xyz \
--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).