]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
qemu: dfu: Correct memset call in set_dfu_alt_info
authorTom Rini <trini@konsulko.com>
Thu, 6 Apr 2023 13:58:40 +0000 (09:58 -0400)
committerTom Rini <trini@konsulko.com>
Tue, 25 Apr 2023 19:31:28 +0000 (15:31 -0400)
When building with clang, we see:
board/emulation/common/qemu_dfu.c:51:24: warning: 'memset' call operates on objects of type 'char' while the size is based on a different type 'char *' [-Wsizeof-pointer-memaccess]

As we're calling memset with the length set to the size of the pointer
and not the size of the buffer. Correct this with a call of the size of
the buffer itself.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Sughosh Ganu <sughosh.ganu@linaro.org>
board/emulation/common/qemu_dfu.c

index 332d659c1f7c278c604004754afb48297df9e9ed..7e7d84f6c00ffcf49181cf9b9ab18d6a5890e3e8 100644 (file)
@@ -48,7 +48,7 @@ void set_dfu_alt_info(char *interface, char *devstr)
            env_get("dfu_alt_info"))
                return;
 
-       memset(buf, 0, sizeof(buf));
+       memset(buf, 0, DFU_ALT_BUF_LEN);
 
        /*
         * Currently dfu_alt_info is needed on Qemu ARM64 for