summaryrefslogtreecommitdiff
path: root/drivers/net/failsafe/failsafe_eal.c
diff options
context:
space:
mode:
authorBruce Richardson <bruce.richardson@intel.com>2019-04-03 15:45:05 +0100
committerThomas Monjalon <thomas@monjalon.net>2019-04-04 22:46:05 +0200
commit6723c0fc7207ca4416822b170b1485a78aa47c7c (patch)
treefef3c6683019dcdf1403761e047308af49f49f8f /drivers/net/failsafe/failsafe_eal.c
parentf9acaf84e923066344bd3467e4703da66f1f23a8 (diff)
downloaddpdk-next-eventdev-6723c0fc7207ca4416822b170b1485a78aa47c7c.zip
dpdk-next-eventdev-6723c0fc7207ca4416822b170b1485a78aa47c7c.tar.gz
dpdk-next-eventdev-6723c0fc7207ca4416822b170b1485a78aa47c7c.tar.xz
replace snprintf with strlcpy
Do a global replace of snprintf(..."%s",...) with strlcpy, adding in the rte_string_fns.h header if needed. The function changes in this patch were auto-generated via command: spatch --sp-file devtools/cocci/strlcpy.cocci --dir . --in-place and then the files edited using awk to add in the missing header: gawk -i inplace '/include <rte_/ && ! seen { \ print "#include <rte_string_fns.h>"; seen=1} {print}' Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Diffstat (limited to 'drivers/net/failsafe/failsafe_eal.c')
-rw-r--r--drivers/net/failsafe/failsafe_eal.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c
index 74fd8e9..820a915 100644
--- a/drivers/net/failsafe/failsafe_eal.c
+++ b/drivers/net/failsafe/failsafe_eal.c
@@ -3,6 +3,7 @@
* Copyright 2017 Mellanox Technologies, Ltd
*/
+#include <rte_string_fns.h>
#include <rte_malloc.h>
#include "failsafe_private.h"
@@ -84,8 +85,9 @@ fs_bus_init(struct rte_eth_dev *dev)
snprintf(devstr, sizeof(devstr), "%s,%s",
probed_da->name, probed_da->args);
else
- snprintf(devstr, sizeof(devstr), "%s",
- rte_eth_devices[pid].device->name);
+ strlcpy(devstr,
+ rte_eth_devices[pid].device->name,
+ sizeof(devstr));
ret = rte_devargs_parse(da, devstr);
if (ret) {
ERROR("Probed devargs parsing failed with code"