[dpdk-stable] patch 'ethdev: fix string length in name comparison' has been queued to LTS release 16.11.7

luca.boccassi at gmail.com luca.boccassi at gmail.com
Tue May 1 12:44:36 CEST 2018


Hi,

FYI, your patch has been queued to LTS release 16.11.7

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 05/03/18. So please
shout if anyone has objections.

Thanks.

Luca Boccassi

---
>From 8c943c2de3a2ed1e6848ed6e194bb20efd149a0c Mon Sep 17 00:00:00 2001
From: Mohammad Abdul Awal <mohammad.abdul.awal at intel.com>
Date: Tue, 27 Feb 2018 08:58:27 +0000
Subject: [PATCH] ethdev: fix string length in name comparison

[ upstream commit b4572daa2c1056ba5a346841135747e8a2ea356e ]

The current code compares two strings upto the length of 1st string
(searched name). If the 1st string is prefix of 2nd string (existing name),
the string comparison returns the port_id of earliest prefix matches.
This patch fixes the bug by using strcmp instead of strncmp.

Fixes: 9c5b8d8b9fe ("ethdev: clean port id retrieval when attaching")

Signed-off-by: Mohammad Abdul Awal <mohammad.abdul.awal at intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev at intel.com>
---
 lib/librte_ether/rte_ethdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 4679dc698..fed09c90e 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -438,8 +438,7 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id)
 
 	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
 
-		if (!strncmp(name,
-			rte_eth_dev_data[i].name, strlen(name))) {
+		if (!strcmp(name, rte_eth_dev_data[i].name)) {
 
 			*port_id = i;
 
-- 
2.14.2



More information about the stable mailing list