numam-dpdk/drivers/net/hinic
Kevin Traynor ece8e4c262 net/hinic: fix repeating cable log and length check
gcc 10.0.1 reports:

../drivers/net/hinic/base/hinic_pmd_hwdev.c: In function ‘print_cable_info’:
../drivers/net/hinic/base/hinic_pmd_hwdev.c:1398:3:
warning:
‘snprintf’ argument 4 may overlap destination object ‘tmp_str’
[-Wrestrict]
 1398 |   snprintf(tmp_str + strlen(tmp_str), (sizeof(tmp_str) - 1),
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1399 |     "%s, Temperature: %u", tmp_str,
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1400 |     info->cable_temp);
      |     ~~~~~~~~~~~~~~~~~

The warning is that tmp_str is in both src and dest.

Anyway, the current code is incorrect and because of the +strlen
the existing string will be repeated twice and max length
does not limit to the end of the string.

Fix by removing tmp_str from the src of snprintf and adding the
correct max length.

Fixes: d9ce191794 ("net/hinic/base: add hardware operation")
Cc: stable@dpdk.org

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2020-03-18 10:21:42 +01:00
..
base net/hinic: fix repeating cable log and length check 2020-03-18 10:21:42 +01:00
hinic_pmd_ethdev.c net/hinic: fix secondary process 2019-11-20 17:36:06 +01:00
hinic_pmd_ethdev.h net/hinic: support inner L3 checksum offload 2019-10-23 16:43:08 +02:00
hinic_pmd_flow.c net/hinic: flush flow director filter 2019-10-23 16:43:08 +02:00
hinic_pmd_rx.c net/hinic: optimize mbuf allocation 2019-11-08 23:15:05 +01:00
hinic_pmd_rx.h net/hinic: optimize Rx performance 2019-10-23 16:43:08 +02:00
hinic_pmd_tx.c net/hinic: fix offload info calculating for TSO 2019-11-08 23:15:05 +01:00
hinic_pmd_tx.h net/hinic: support inner L3 checksum offload 2019-10-23 16:43:08 +02:00
Makefile build: remove individual library versions 2019-11-20 23:05:39 +01:00
meson.build net/hinic: add flow validation operations 2019-10-23 16:43:08 +02:00
rte_pmd_hinic_version.map build: align symbols with global ABI version 2019-11-20 23:05:39 +01:00