All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Thomas Monjalon <thomas@monjalon.net>,
	Hemant Agrawal <hemant.agrawal@nxp.com>,
	Shreyansh Jain <shreyansh.jain@nxp.com>
Cc: dev@dpdk.org, Ferruh Yigit <ferruh.yigit@intel.com>, stable@dpdk.org
Subject: [PATCH 1/2] bus/dpaa: fix build with gcc 9.0
Date: Thu,  1 Nov 2018 13:19:50 +0000	[thread overview]
Message-ID: <20181101131951.91459-1-ferruh.yigit@intel.com> (raw)

build error:
In function ‘fman_if_init’,
    .../drivers/bus/dpaa/base/fman/fman.c:186:2:
    error: ‘strncpy’ output may be truncated copying 4095 bytes from a
           string of length 4095 [-Werror=stringop-truncation]
    strncpy(__if->node_path, dpa_node->full_name, PATH_MAX - 1);

strncpy may result a not null-terminated string,
replaced it with rte_strscpy

Fixes: 5b22cf744689 ("bus/dpaa: introducing FMan configurations")
Cc: stable@dpdk.org

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 drivers/bus/dpaa/base/fman/fman.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c
index bdb700423..ddcd7d1f3 100644
--- a/drivers/bus/dpaa/base/fman/fman.c
+++ b/drivers/bus/dpaa/base/fman/fman.c
@@ -13,6 +13,7 @@
 #include <fman.h>
 #include <of.h>
 #include <rte_dpaa_logs.h>
+#include <rte_string_fns.h>
 
 #define QMI_PORT_REGS_OFFSET		0x400
 
@@ -183,7 +184,7 @@ fman_if_init(const struct device_node *dpa_node)
 	}
 	memset(__if, 0, sizeof(*__if));
 	INIT_LIST_HEAD(&__if->__if.bpool_list);
-	strncpy(__if->node_path, dpa_node->full_name, PATH_MAX - 1);
+	rte_strscpy(__if->node_path, dpa_node->full_name, PATH_MAX - 1);
 	__if->node_path[PATH_MAX - 1] = '\0';
 
 	/* Obtain the MAC node used by this interface except macless */
-- 
2.17.2

             reply	other threads:[~2018-11-01 13:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-01 13:19 Ferruh Yigit [this message]
2018-11-01 12:49 ` [PATCH 1/2] bus/dpaa: fix build with gcc 9.0 Shreyansh Jain
2018-11-01 13:19 ` [PATCH 2/2] eal: " Ferruh Yigit
2018-11-01 17:42 ` [PATCH 1/2] bus/dpaa: " Stephen Hemminger
2018-11-01 17:45   ` Bruce Richardson
2018-11-01 18:21     ` Ferruh Yigit
2018-11-01 19:45       ` Thomas Monjalon
2018-11-02 19:06 ` [PATCH v2 " Ferruh Yigit
2018-11-02 19:06   ` [PATCH v2 2/2] eal: " Ferruh Yigit
2018-11-04 21:38     ` [dpdk-stable] " Thomas Monjalon

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=20181101131951.91459-1-ferruh.yigit@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=shreyansh.jain@nxp.com \
    --cc=stable@dpdk.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.