Skip to content
Snippets Groups Projects
Commit 76df2b8d authored by Eric Blake's avatar Eric Blake
Browse files

nbd/server: Silence clang sanitizer warning


clang's sanitizer is picky: memset(NULL, x, 0) is technically
undefined behavior, even though no sane implementation of memset()
deferences the NULL.  Caught by the nbd-qemu-allocation iotest.

The alternative to checking before each memset is to instead force an
allocation of 1 element instead of g_new0(type, 0)'s behavior of
returning NULL for a 0-length array.

Reported-by: default avatarPeter Maydell <peter.maydell@linaro.org>
Fixes: 3b1f244c (nbd: Allow export of multiple bitmaps for one device)
Signed-off-by: default avatarEric Blake <eblake@redhat.com>
Message-Id: <20211115223943.626416-1-eblake@redhat.com>
Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
parent 9f0f8464
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment