qemu: dfu: Correct memset call in set_dfu_alt_info
PATCH 1/1 qemu: dfu: Correct memset call in set_dfu_alt_info
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.
---
Cc: Tuomas Tynkkynen <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Simon Glass <[email protected]>
--- board/emulation/common/qemu_dfu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
board/emulation/common/qemu_dfu.c +1 -1
@@ -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
Signature · 1 line
2.34.1
Quoted 8 lines · Tom Rini
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.
Quoted 8 lines
Signed-off-by Tom Rini <[email protected]>---
Cc: Tuomas Tynkkynen <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Simon Glass <[email protected]>--- board/emulation/common/qemu_dfu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 10 lines · Tom Rini
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 <[email protected]>---
-sughosh
Quoted 23 lines
Cc Tuomas Tynkkynen <[email protected]>Cc Sughosh Ganu <[email protected]>Cc Simon Glass <[email protected]>--- board/emulation/common/qemu_dfu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)board/emulation/common/qemu_dfu.c +1
-2@@ -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 -- 2.34.1
Quoted 10 lines · Tom Rini
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 <[email protected]>Reviewed-by Simon Glass <[email protected]>Acked-by Sughosh Ganu <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom