diff mbox series

[v2,1/2] bus/dpaa: fix build with gcc 9.0

Message ID 20181102190606.48279-1-ferruh.yigit@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers show
Series [v2,1/2] bus/dpaa: fix build with gcc 9.0 | expand

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Ferruh Yigit Nov. 2, 2018, 7:06 p.m. UTC
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 strlcpy

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

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

Patch

diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c
index bdb700423..06762e0f4 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);
+	strlcpy(__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 */