summaryrefslogtreecommitdiff
path: root/lib/librte_eal/common/eal_common_bus.c
diff options
context:
space:
mode:
authorBruce Richardson <bruce.richardson@intel.com>2018-03-12 11:33:00 +0000
committerThomas Monjalon <thomas@monjalon.net>2018-04-04 17:33:08 +0200
commitc022cb400e920624dd10e162ef12917b3039b846 (patch)
treec4c92b3ded4f9f0408aad7e606c22fd8226c93d8 /lib/librte_eal/common/eal_common_bus.c
parent5364de644a4ba99497edbed05bff942b2b461413 (diff)
downloaddpdk-c022cb400e920624dd10e162ef12917b3039b846.zip
dpdk-c022cb400e920624dd10e162ef12917b3039b846.tar.gz
dpdk-c022cb400e920624dd10e162ef12917b3039b846.tar.xz
convert snprintf to strlcpy
Since we have support for the strlcpy function in DPDK, replace all instances where a string is copied using snprintf. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
Diffstat (limited to 'lib/librte_eal/common/eal_common_bus.c')
-rw-r--r--lib/librte_eal/common/eal_common_bus.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c
index 3e022d5..0943851 100644
--- a/lib/librte_eal/common/eal_common_bus.c
+++ b/lib/librte_eal/common/eal_common_bus.c
@@ -36,6 +36,7 @@
#include <rte_bus.h>
#include <rte_debug.h>
+#include <rte_string_fns.h>
#include "eal_private.h"
@@ -212,7 +213,7 @@ rte_bus_find_by_device_name(const char *str)
char name[RTE_DEV_NAME_MAX_LEN];
char *c;
- snprintf(name, sizeof(name), "%s", str);
+ strlcpy(name, str, sizeof(name));
c = strchr(name, ',');
if (c != NULL)
c[0] = '\0';