From: Andy Green <andy@warmcat.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] bus/ifpga: fix strncpy with wrong length with strlcpy
Date: Sun, 13 May 2018 11:24:12 +0800 [thread overview]
Message-ID: <152618185248.125230.3244687143464768033.stgit@localhost.localdomain> (raw)
In function ‘ifpga_scan_one’,
inlined from ‘ifpga_scan’ at /home/agreen/projects/
lagopus/src/dpdk/drivers/bus/ifpga/ifpga_bus.c:229:13:
/home/agreen/projects/lagopus/src/dpdk/drivers/bus/ifpga/
ifpga_bus.c:161:2: error: ‘strncpy’ specified bound 256
equals destination size [-Werror=stringop-truncation]
strncpy(afu_pr_conf.bs_path, path,
sizeof(afu_pr_conf.bs_path));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~
Signed-off-by: Andy Green <andy@warmcat.com>
Fixes: 05fa3d4a65 ("bus/ifpga: add Intel FPGA bus library")
---
drivers/bus/ifpga/ifpga_bus.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index 16b7e06b6..08b3c8fdd 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -20,6 +20,7 @@
#include <rte_memzone.h>
#include <rte_eal.h>
#include <rte_common.h>
+#include <rte_string_fns.h>
#include <rte_devargs.h>
#include <rte_kvargs.h>
@@ -158,7 +159,7 @@ ifpga_scan_one(struct rte_rawdev *rawdev,
rawdev->dev_ops->dev_start(rawdev))
goto free_dev;
- strncpy(afu_pr_conf.bs_path, path, sizeof(afu_pr_conf.bs_path));
+ strlcpy(afu_pr_conf.bs_path, path, sizeof(afu_pr_conf.bs_path));
if (rawdev->dev_ops->firmware_load &&
rawdev->dev_ops->firmware_load(rawdev,
&afu_pr_conf)){
next reply other threads:[~2018-05-13 3:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-13 3:24 Andy Green [this message]
2018-05-13 3:26 ` Andy Green
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=152618185248.125230.3244687143464768033.stgit@localhost.localdomain \
--to=andy@warmcat.com \
--cc=dev@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).