linux/drivers/net/ethernet/netronome/nfp/nfpcore
Jakub Kicinski f8d0efb112 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>
2018-06-12 15:18:28 -07:00
..
nfp6000 nfp: add Makefiles to all directories 2018-02-22 15:22:50 -05:00
Makefile nfp: add Makefiles to all directories 2018-02-22 15:22:50 -05:00
crc32.h
nfp.h nfp: reset local locks on init 2018-04-25 14:07:04 -04:00
nfp6000_pcie.c nfp: core: allow 4-byte aligned accesses to Memory Units 2018-05-23 14:26:18 -04:00
nfp6000_pcie.h
nfp_arm.h
nfp_cpp.h nfp: abm: add helpers for configuring queue marking levels 2018-05-29 09:49:15 -04:00
nfp_cppcore.c nfp: core: make scalar CPP helpers fail on short accesses 2018-01-19 15:44:18 -05:00
nfp_cpplib.c nfp: core: make scalar CPP helpers fail on short accesses 2018-01-19 15:44:18 -05:00
nfp_hwinfo.c nfp: dump all hwinfo 2017-12-05 15:01:02 -05:00
nfp_mip.c nfp: report application FW build name in ethtool -i 2017-06-09 12:52:09 -04:00
nfp_mutex.c nfp: reset local locks on init 2018-04-25 14:07:04 -04:00
nfp_nffw.c nfp: add support for reading nffw info 2017-02-10 15:52:25 -05:00
nfp_nffw.h nfp: nfpcore: add rtsym writing function 2018-05-24 23:10:56 -04:00
nfp_nsp.c nfp: ignore signals when communicating with management FW 2018-04-12 21:57:27 -04:00
nfp_nsp.h nfp: fix kdoc warnings on nested structures 2018-02-06 11:43:58 -05:00
nfp_nsp_cmds.c nfp: add hwmon support 2017-05-30 11:27:06 -04:00
nfp_nsp_eth.c nfp: add helpers for FEC support 2017-11-05 23:23:26 +09:00
nfp_resource.c nfp: don't pad strings in nfp_cpp_resource_find() to avoid gcc 8 warning 2018-06-12 15:18:28 -07:00
nfp_rtsym.c nfp: nfpcore: add rtsym writing function 2018-05-24 23:10:56 -04:00
nfp_target.c