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 <d...@dxuuu.xyz> > --- > crypto/block-luks.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Daniel P. Berrangé <berra...@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 :|