mirror of
https://github.com/linux-usb-gadgets/libusbgx.git
synced 2025-07-13 16:49:57 +03:00
function: ms: fix compile warning for out of bounds in ms.c
FAILED: libusbgx.so.2.0.0.p/src_function_ms.c.o aarch64-v8a-linux-gnu-gcc -Ilibusbgx.so.2.0.0.p -I. -I../../../../../../../../../../../../r/libusbgx -I../../../../../../../../../../../../r/libusbgx/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -O2 -g -D_GNU_SOURCE -fPIC -DHAS_GADGET_SCHEMES -MD -MQ libusbgx.so.2.0.0.p/src_function_ms.c.o -MF libusbgx.so.2.0.0.p/src_function_ms.c.o.d -o libusbgx.so.2.0.0.p/src_function_ms.c.o -c ../../../../../../../../../../../../r/libusbgx/src/function/ms.c In file included from /opt/OSELAS.Toolchain-2023.07.1/aarch64-v8a-linux-gnu/gcc-13.2.1-clang-16.0.6-glibc-2.37-binutils-2.40-kernel-6.3.6-sanitized/sysroot-aarch64-v8a-linux-gnu/usr/include/string.h:535, from ../../../../../../../../../../../../r/libusbgx/include/usbg/usbg_internal.h:17, from ../../../../../../../../../../../../r/libusbgx/src/function/ms.c:14: In function 'memset', inlined from 'ms_alloc_inst' at ../../../../../../../../../../../../r/libusbgx/src/function/ms.c:169:2, inlined from 'ms_alloc_inst' at ../../../../../../../../../../../../r/libusbgx/src/function/ms.c:154:12: /opt/OSELAS.Toolchain-2023.07.1/aarch64-v8a-linux-gnu/gcc-13.2.1-clang-16.0.6-glibc-2.37-binutils-2.40-kernel-6.3.6-sanitized/sysroot-aarch64-v8a-linux-gnu/usr/include/bits/string_fortified.h:59:10: error: '__builtin_memset' offset [0, 15] is out of the bounds [0, 0] [-Werror=array-bounds=] 59 | return __builtin___memset_chk (__dest, __ch, __len, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 60 | __glibc_objsize0 (__dest)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
parent
bf2bc2310c
commit
bad649b200
1 changed files with 2 additions and 1 deletions
|
@ -166,7 +166,8 @@ static int ms_alloc_inst(struct usbg_function_type *type,
|
|||
goto out;
|
||||
|
||||
mf = usbg_to_ms_function(*f);
|
||||
memset(mf->luns, 0, sizeof(mf->luns));
|
||||
for (int i = 0; i < MAX_LUNS; i++)
|
||||
mf->luns[i] = 0;
|
||||
mf->luns_initiated = false;
|
||||
out:
|
||||
return ret;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue