DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] bus/vmbus: fix wrong allocation for device.name
@ 2020-05-28 12:03 wangyunjian
  2020-05-28 16:12 ` Stephen Hemminger
  2020-05-29 17:47 ` Stephen Hemminger
  0 siblings, 2 replies; 5+ messages in thread
From: wangyunjian @ 2020-05-28 12:03 UTC (permalink / raw)
  To: dev; +Cc: sthemmin, jerry.lilijun, xudingke, Yunjian Wang, stable

From: Yunjian Wang <wangyunjian@huawei.com>

We do not need and should not allocate memory for device.name.
The device.name should be set point to the devargs->name.

Fixes: 831dba47bd36 ("bus/vmbus: add Hyper-V virtual bus support")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 drivers/bus/vmbus/linux/vmbus_bus.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/bus/vmbus/linux/vmbus_bus.c b/drivers/bus/vmbus/linux/vmbus_bus.c
index 3c924ee..31d0dd3 100644
--- a/drivers/bus/vmbus/linux/vmbus_bus.c
+++ b/drivers/bus/vmbus/linux/vmbus_bus.c
@@ -242,9 +242,6 @@
 		return -1;
 
 	dev->device.bus = &rte_vmbus_bus.bus;
-	dev->device.name = strdup(name);
-	if (!dev->device.name)
-		goto error;
 
 	/* sysfs base directory
 	 *   /sys/bus/vmbus/devices/7a08391f-f5a0-4ac0-9802-d13fd964f8df
@@ -296,6 +293,7 @@
 	}
 
 	dev->device.devargs = vmbus_devargs_lookup(dev);
+	dev->device.name = dev->device.devargs->name;
 
 	/* device is valid, add in list (sorted) */
 	VMBUS_LOG(DEBUG, "Adding vmbus device %s", name);
-- 
1.8.3.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-06-01  2:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-28 12:03 [dpdk-dev] [PATCH] bus/vmbus: fix wrong allocation for device.name wangyunjian
2020-05-28 16:12 ` Stephen Hemminger
2020-05-29  7:24   ` wangyunjian
2020-05-29 17:47 ` Stephen Hemminger
2020-06-01  2:02   ` wangyunjian

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).