patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Andy Green <andy@warmcat.com>
To: stable@dpdk.org
Subject: [dpdk-stable] [PATCH 3/5] net/qede: fix strncpy
Date: Fri, 18 May 2018 19:38:03 +0800	[thread overview]
Message-ID: <152664348393.25528.5997956512144600818.stgit@localhost.localdomain> (raw)
In-Reply-To: <152664333397.25528.18140247166845268675.stgit@localhost.localdomain>

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>
---
 drivers/net/qede/qede_main.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c
index ae1873215..04e98b758 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"
 
@@ -302,9 +303,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) {

  parent reply	other threads:[~2018-05-18 11:38 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-30 15:23 [dpdk-stable] please help backporting some patches to stable release 18.02.2 luca.boccassi
2018-04-30 15:30 ` Maxime Coquelin
2018-04-30 15:44   ` Luca Boccassi
2018-04-30 16:06 ` Burakov, Anatoly
2018-04-30 16:33   ` Luca Boccassi
2018-05-02  6:04 ` Hyong Youb Kim
2018-05-02 10:43   ` Luca Boccassi
2018-05-02  8:27 ` Nélio Laranjeiro
2018-05-02 10:42   ` Luca Boccassi
2018-05-18  9:46 ` luca.boccassi
2018-05-18 10:11   ` Richardson, Bruce
2018-05-18 10:21     ` Luca Boccassi
2018-05-18 10:25   ` Andy Green
2018-05-18 10:33     ` Pattan, Reshma
2018-05-18 10:36       ` Andy Green
2018-05-18 11:37   ` [dpdk-stable] [PATCH 0/5] 18.02 Requested backports Andy Green
2018-05-18 11:37     ` [dpdk-stable] [PATCH 1/5] eal: support strlcpy function Andy Green
2018-05-18 11:37     ` [dpdk-stable] [PATCH 2/5] bus/pci: fix size of driver name buffer Andy Green
2018-05-18 11:38     ` Andy Green [this message]
2018-05-18 11:38     ` [dpdk-stable] [PATCH 4/5] net/qede: replace strncpy by strlcpy Andy Green
2018-05-18 11:38     ` [dpdk-stable] [PATCH 5/5] net/sfc: make sure that stats name is nul-terminated Andy Green
2018-05-18 13:13     ` [dpdk-stable] [PATCH 0/5] 18.02 Requested backports Luca Boccassi
2018-05-25 17:23   ` [dpdk-stable] please help backporting some patches to stable release 18.02.2 luca.boccassi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=152664348393.25528.5997956512144600818.stgit@localhost.localdomain \
    --to=andy@warmcat.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).