patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Andy Green <andy@warmcat.com>
To: stable@dpdk.org
Subject: [dpdk-stable] [PATCH 5/5] net/sfc: make sure that stats name is nul-terminated
Date: Fri, 18 May 2018 19:38:14 +0800	[thread overview]
Message-ID: <152664349400.25528.10851185997497857930.stgit@localhost.localdomain> (raw)
In-Reply-To: <152664333397.25528.18140247166845268675.stgit@localhost.localdomain>

Fixes: 73280c1e4ff2 ("net/sfc: support xstats retrieval by ID")
Fixes: 7b9891769f4b ("net/sfc: support extended statistics")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/sfc_ethdev.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 2f5f86f84..7373ebeec 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -35,6 +35,7 @@
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
 #include <rte_errno.h>
+#include <rte_string_fns.h>
 
 #include "efx.h"
 
@@ -666,7 +667,7 @@ sfc_xstats_get_names(struct rte_eth_dev *dev,
 	for (i = 0; i < EFX_MAC_NSTATS; ++i) {
 		if (EFX_MAC_STAT_SUPPORTED(port->mac_stats_mask, i)) {
 			if (xstats_names != NULL && nstats < xstats_count)
-				strncpy(xstats_names[nstats].name,
+				strlcpy(xstats_names[nstats].name,
 					efx_mac_stat_name(sa->nic, i),
 					sizeof(xstats_names[0].name));
 			nstats++;
@@ -744,9 +745,8 @@ sfc_xstats_get_names_by_id(struct rte_eth_dev *dev,
 		if ((ids == NULL) || (ids[nb_written] == nb_supported)) {
 			char *name = xstats_names[nb_written++].name;
 
-			strncpy(name, efx_mac_stat_name(sa->nic, i),
+			strlcpy(name, efx_mac_stat_name(sa->nic, i),
 				sizeof(xstats_names[0].name));
-			name[sizeof(xstats_names[0].name) - 1] = '\0';
 		}
 
 		++nb_supported;

  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     ` [dpdk-stable] [PATCH 3/5] net/qede: fix strncpy Andy Green
2018-05-18 11:38     ` [dpdk-stable] [PATCH 4/5] net/qede: replace strncpy by strlcpy Andy Green
2018-05-18 11:38     ` Andy Green [this message]
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=152664349400.25528.10851185997497857930.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).