mirror of https://gitee.com/openkylin/linux.git
f8d0efb112
Once upon a time nfp_cpp_resource_find() took a name parameter, which could be any user-chosen string. Resources are identified by a CRC32 hash of a 8 byte string, so we had to pad user input with zeros to make sure CRC32 gave the correct result. Since then nfp_cpp_resource_find() was made to operate on allocated resources only (struct nfp_resource). We kzalloc those so there is no need to pad the strings and use memcmp. This avoids a GCC 8 stringop-truncation warning: In function ‘nfp_cpp_resource_find’, inlined from ‘nfp_resource_try_acquire’ at .../nfpcore/nfp_resource.c:153:8, inlined from ‘nfp_resource_acquire’ at .../nfpcore/nfp_resource.c:206:9: .../nfpcore/nfp_resource.c:108:2: warning: strncpy’ output may be truncated copying 8 bytes from a string of length 8 [-Wstringop-truncation] strncpy(name_pad, res->name, sizeof(name_pad)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net> |
||
---|---|---|
.. | ||
nfp6000 | ||
Makefile | ||
crc32.h | ||
nfp.h | ||
nfp6000_pcie.c | ||
nfp6000_pcie.h | ||
nfp_arm.h | ||
nfp_cpp.h | ||
nfp_cppcore.c | ||
nfp_cpplib.c | ||
nfp_hwinfo.c | ||
nfp_mip.c | ||
nfp_mutex.c | ||
nfp_nffw.c | ||
nfp_nffw.h | ||
nfp_nsp.c | ||
nfp_nsp.h | ||
nfp_nsp_cmds.c | ||
nfp_nsp_eth.c | ||
nfp_resource.c | ||
nfp_rtsym.c | ||
nfp_target.c |