From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 62495A00BE; Thu, 28 May 2020 14:03:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3353E1DB97; Thu, 28 May 2020 14:03:32 +0200 (CEST) Received: from huawei.com (szxga07-in.huawei.com [45.249.212.35]) by dpdk.org (Postfix) with ESMTP id 384311D9F3; Thu, 28 May 2020 14:03:31 +0200 (CEST) Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 6B3D34748E5EFA122BA9; Thu, 28 May 2020 20:03:26 +0800 (CST) Received: from localhost (10.173.251.152) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.487.0; Thu, 28 May 2020 20:03:19 +0800 From: wangyunjian To: CC: , , , Yunjian Wang , Date: Thu, 28 May 2020 20:03:07 +0800 Message-ID: <768c74d06680b93b2ce6bbf0813d1910666888dc.1590666521.git.wangyunjian@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.173.251.152] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH] bus/vmbus: fix wrong allocation for device.name X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Yunjian Wang 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 --- 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