From: Yongseok Koh <yskoh@mellanox.com>
To: alejandro.lucero@netronome.com, cristian.dumitrescu@intel.com
Cc: stable@dpdk.org
Subject: [dpdk-stable] [PATCH 17.11 2/2] net/nfp: replace strncpy by strlcpy
Date: Thu, 3 Jan 2019 00:26:27 -0800 [thread overview]
Message-ID: <20190103082627.17224-2-yskoh@mellanox.com> (raw)
In-Reply-To: <20190103082627.17224-1-yskoh@mellanox.com>
GCC 8.1 error:
drivers/net/nfp/nfp_nspu.c: In function
‘nfp_nspu_set_bar_from_symbl.constprop’:
drivers/net/nfp/nfp_nspu.c:426:2: error: ‘strncpy’ output truncated
before terminating nul copying as many bytes from a string as its length
[-Werror=stringop-truncation]
strncpy(sym_buf, symbl, strlen(symbl));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fixes: dd63df2bfff3 ("net/nfp: add NSP symbol resolution command")
Cc: alejandro.lucero@netronome.com
Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---
drivers/net/nfp/nfp_nspu.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/nfp/nfp_nspu.c b/drivers/net/nfp/nfp_nspu.c
index f90898321..ac5bce3b1 100644
--- a/drivers/net/nfp/nfp_nspu.c
+++ b/drivers/net/nfp/nfp_nspu.c
@@ -9,6 +9,7 @@
#include <rte_log.h>
#include <rte_byteorder.h>
+#include <rte_string_fns.h>
#include "nfp_nfpu.h"
@@ -423,7 +424,7 @@ nfp_nspu_set_bar_from_symbl(nspu_desc_t *desc, const char *symbl,
if (!sym_buf)
return -ENOMEM;
- strncpy(sym_buf, symbl, strlen(symbl));
+ strlcpy(sym_buf, symbl, sizeof(sym_buf));
ret = nspu_command(desc, NSP_CMD_GET_SYMBOL, 1, 1, sym_buf,
NFP_SYM_DESC_LEN, strlen(symbl));
if (ret) {
--
2.11.0
next prev parent reply other threads:[~2019-01-03 8:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-03 8:26 [dpdk-stable] [PATCH 17.11 1/2] table: fix casting cuckoo hash function Yongseok Koh
2019-01-03 8:26 ` Yongseok Koh [this message]
2019-01-03 8:31 ` [dpdk-stable] [PATCH 17.11 2/2] net/nfp: replace strncpy by strlcpy Yongseok Koh
2019-01-03 8:29 ` [dpdk-stable] [PATCH 17.11 1/2] table: fix casting cuckoo hash function Yongseok Koh
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=20190103082627.17224-2-yskoh@mellanox.com \
--to=yskoh@mellanox.com \
--cc=alejandro.lucero@netronome.com \
--cc=cristian.dumitrescu@intel.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).