DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pablo de Lara <pablo.de.lara.guarch@intel.com>
To: thomas@monjalon.net, rosen.xu@intel.com
Cc: dev@dpdk.org, Pablo de Lara <pablo.de.lara.guarch@intel.com>
Subject: [dpdk-dev] [PATCH] bus/fpga: use strlcpy instead of strncpy
Date: Sat, 12 May 2018 08:02:17 +0100	[thread overview]
Message-ID: <20180512070217.16735-1-pablo.de.lara.guarch@intel.com> (raw)

Gcc 8 reports a build error:

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));
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: 05fa3d4a6539 ("bus/ifpga: add Intel FPGA bus library")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 drivers/bus/ifpga/ifpga_bus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index 16b7e06b6..45597a1bb 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -20,10 +20,10 @@
 #include <rte_memzone.h>
 #include <rte_eal.h>
 #include <rte_common.h>
-
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
 #include <rte_alarm.h>
+#include <rte_string_fns.h>
 
 #include "rte_rawdev.h"
 #include "rte_rawdev_pmd.h"
@@ -158,7 +158,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)){
-- 
2.17.0

             reply	other threads:[~2018-05-12  7:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-12  7:02 Pablo de Lara [this message]
2018-05-13 10:07 ` Thomas Monjalon
2018-05-14 10:06   ` Xu, Rosen

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=20180512070217.16735-1-pablo.de.lara.guarch@intel.com \
    --to=pablo.de.lara.guarch@intel.com \
    --cc=dev@dpdk.org \
    --cc=rosen.xu@intel.com \
    --cc=thomas@monjalon.net \
    /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).