summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Green <andy@warmcat.com>2018-05-14 13:00:42 +0800
committerFerruh Yigit <ferruh.yigit@intel.com>2018-05-14 23:32:23 +0200
commitf28742ba06a83a0bb8f658e12105e975ab7b26d7 (patch)
tree8e67ee00e6886bcc0e987695fbb7368e650838e5
parent0fa4f3eeefb3e76124f5bbc1fccedcf43f4503f3 (diff)
downloaddpdk-f28742ba06a83a0bb8f658e12105e975ab7b26d7.zip
dpdk-f28742ba06a83a0bb8f658e12105e975ab7b26d7.tar.gz
dpdk-f28742ba06a83a0bb8f658e12105e975ab7b26d7.tar.xz
net/qede: fix strncpy
drivers/net/qede/qede_main.c: In function ‘qed_slowpath_start’: drivers/net/qede/qede_main.c:307:3: error: ‘strncpy’ output may be truncated copying 12 bytes from a string of length 127 [-Werror=stringop-truncation] strncpy((char *)drv_version.name, (const char *)params->name, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MCP_DRV_VER_STR_SIZE - 4); ~~~~~~~~~~~~~~~~~~~~~~~~~ Fixes: 86a2265e59d7 ("qede: add SRIOV support") Cc: stable@dpdk.org Signed-off-by: Andy Green <andy@warmcat.com> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
-rw-r--r--drivers/net/qede/qede_main.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c
index 2333ca0..ee63ac2 100644
--- a/drivers/net/qede/qede_main.c
+++ b/drivers/net/qede/qede_main.c
@@ -9,6 +9,7 @@
#include <limits.h>
#include <time.h>
#include <rte_alarm.h>
+#include <rte_string_fns.h>
#include "qede_ethdev.h"
@@ -303,9 +304,8 @@ static int qed_slowpath_start(struct ecore_dev *edev,
drv_version.version = (params->drv_major << 24) |
(params->drv_minor << 16) |
(params->drv_rev << 8) | (params->drv_eng);
- /* TBD: strlcpy() */
- strncpy((char *)drv_version.name, (const char *)params->name,
- MCP_DRV_VER_STR_SIZE - 4);
+ strlcpy((char *)drv_version.name, (const char *)params->name,
+ sizeof(drv_version.name));
rc = ecore_mcp_send_drv_version(hwfn, hwfn->p_main_ptt,
&drv_version);
if (rc) {