* [dpdk-dev] [PATCH] eal/linux: use strlcpy in uevent parsing
@ 2018-04-17 11:57 Thomas Monjalon
2018-04-17 12:23 ` [dpdk-dev] [PATCH v2] " Thomas Monjalon
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Monjalon @ 2018-04-17 11:57 UTC (permalink / raw)
To: dev; +Cc: anatoly.burakov, bruce.richardson, jia.guo
Support of strlcpy has recently been added to DPDK.
This replacement has been generated by the coccinelle script:
devtools/cocci.sh devtools/cocci/strlcpy.cocci
Fixes: 0d0f478d0483 ("eal/linux: add uevent parse and process")
Cc: jia.guo@intel.com
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
lib/librte_eal/linuxapp/eal/eal_dev.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/librte_eal/linuxapp/eal/eal_dev.c b/lib/librte_eal/linuxapp/eal/eal_dev.c
index 9478a39a5..d02bba11e 100644
--- a/lib/librte_eal/linuxapp/eal/eal_dev.c
+++ b/lib/librte_eal/linuxapp/eal/eal_dev.c
@@ -94,15 +94,15 @@ dev_uev_parse(const char *buf, struct rte_dev_event *event, int length)
if (!strncmp(buf, "ACTION=", 7)) {
buf += 7;
i += 7;
- snprintf(action, sizeof(action), "%s", buf);
+ strlcpy(action, buf, sizeof(action));
} else if (!strncmp(buf, "SUBSYSTEM=", 10)) {
buf += 10;
i += 10;
- snprintf(subsystem, sizeof(subsystem), "%s", buf);
+ strlcpy(subsystem, buf, sizeof(subsystem));
} else if (!strncmp(buf, "PCI_SLOT_NAME=", 14)) {
buf += 14;
i += 14;
- snprintf(pci_slot_name, sizeof(subsystem), "%s", buf);
+ strlcpy(pci_slot_name, buf, sizeof(subsystem));
event->devname = strdup(pci_slot_name);
}
for (; i < length; i++) {
--
2.16.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [dpdk-dev] [PATCH v2] eal/linux: use strlcpy in uevent parsing
2018-04-17 11:57 [dpdk-dev] [PATCH] eal/linux: use strlcpy in uevent parsing Thomas Monjalon
@ 2018-04-17 12:23 ` Thomas Monjalon
2018-04-23 14:15 ` Bruce Richardson
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Monjalon @ 2018-04-17 12:23 UTC (permalink / raw)
To: dev; +Cc: anatoly.burakov, bruce.richardson
Support of strlcpy has recently been added to DPDK.
This replacement has been generated by the coccinelle script:
devtools/cocci.sh devtools/cocci/strlcpy.cocci
Fixes: 0d0f478d0483 ("eal/linux: add uevent parse and process")
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
v2: add missing include
---
lib/librte_eal/linuxapp/eal/eal_dev.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/librte_eal/linuxapp/eal/eal_dev.c b/lib/librte_eal/linuxapp/eal/eal_dev.c
index 9478a39a5..1cf6aebff 100644
--- a/lib/librte_eal/linuxapp/eal/eal_dev.c
+++ b/lib/librte_eal/linuxapp/eal/eal_dev.c
@@ -7,6 +7,7 @@
#include <sys/socket.h>
#include <linux/netlink.h>
+#include <rte_string_fns.h>
#include <rte_log.h>
#include <rte_compat.h>
#include <rte_dev.h>
@@ -94,15 +95,15 @@ dev_uev_parse(const char *buf, struct rte_dev_event *event, int length)
if (!strncmp(buf, "ACTION=", 7)) {
buf += 7;
i += 7;
- snprintf(action, sizeof(action), "%s", buf);
+ strlcpy(action, buf, sizeof(action));
} else if (!strncmp(buf, "SUBSYSTEM=", 10)) {
buf += 10;
i += 10;
- snprintf(subsystem, sizeof(subsystem), "%s", buf);
+ strlcpy(subsystem, buf, sizeof(subsystem));
} else if (!strncmp(buf, "PCI_SLOT_NAME=", 14)) {
buf += 14;
i += 14;
- snprintf(pci_slot_name, sizeof(subsystem), "%s", buf);
+ strlcpy(pci_slot_name, buf, sizeof(subsystem));
event->devname = strdup(pci_slot_name);
}
for (; i < length; i++) {
--
2.16.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH v2] eal/linux: use strlcpy in uevent parsing
2018-04-17 12:23 ` [dpdk-dev] [PATCH v2] " Thomas Monjalon
@ 2018-04-23 14:15 ` Bruce Richardson
2018-04-23 14:23 ` Thomas Monjalon
0 siblings, 1 reply; 4+ messages in thread
From: Bruce Richardson @ 2018-04-23 14:15 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev, anatoly.burakov
On Tue, Apr 17, 2018 at 02:23:29PM +0200, Thomas Monjalon wrote:
> Support of strlcpy has recently been added to DPDK.
>
> This replacement has been generated by the coccinelle script:
> devtools/cocci.sh devtools/cocci/strlcpy.cocci
>
> Fixes: 0d0f478d0483 ("eal/linux: add uevent parse and process")
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
LGTM
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH v2] eal/linux: use strlcpy in uevent parsing
2018-04-23 14:15 ` Bruce Richardson
@ 2018-04-23 14:23 ` Thomas Monjalon
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2018-04-23 14:23 UTC (permalink / raw)
To: Bruce Richardson; +Cc: dev, anatoly.burakov, jia.guo
23/04/2018 16:15, Bruce Richardson:
> On Tue, Apr 17, 2018 at 02:23:29PM +0200, Thomas Monjalon wrote:
> > Support of strlcpy has recently been added to DPDK.
> >
> > This replacement has been generated by the coccinelle script:
> > devtools/cocci.sh devtools/cocci/strlcpy.cocci
> >
> > Fixes: 0d0f478d0483 ("eal/linux: add uevent parse and process")
> >
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > ---
> LGTM
>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Applied
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-04-23 14:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-17 11:57 [dpdk-dev] [PATCH] eal/linux: use strlcpy in uevent parsing Thomas Monjalon
2018-04-17 12:23 ` [dpdk-dev] [PATCH v2] " Thomas Monjalon
2018-04-23 14:15 ` Bruce Richardson
2018-04-23 14:23 ` Thomas Monjalon
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).