summaryrefslogtreecommitdiff
path: root/drivers/soundwire/intel_init.c
diff options
context:
space:
mode:
authorJakub Kicinski <jakub.kicinski@netronome.com>2018-06-12 07:33:35 +0300
committerDavid S. Miller <davem@davemloft.net>2018-06-13 01:18:28 +0300
commitf8d0efb112275444c03b76ee2376f0055d12aeba (patch)
tree9f8fa26171bd78e745f45b77ef15db91659dd078 /drivers/soundwire/intel_init.c
parentcdb8744d80352b55c622d049a6c91f449cd291f8 (diff)
downloadlinux-f8d0efb112275444c03b76ee2376f0055d12aeba.tar.xz
nfp: don't pad strings in nfp_cpp_resource_find() to avoid gcc 8 warning
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>
Diffstat (limited to 'drivers/soundwire/intel_init.c')
0 files changed, 0 insertions, 0 deletions