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 06A69A00BE; Thu, 28 May 2020 18:12:49 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 26F171DC0C; Thu, 28 May 2020 18:12:49 +0200 (CEST) Received: from mail-pj1-f65.google.com (mail-pj1-f65.google.com [209.85.216.65]) by dpdk.org (Postfix) with ESMTP id DD13A1DC0B for ; Thu, 28 May 2020 18:12:47 +0200 (CEST) Received: by mail-pj1-f65.google.com with SMTP id a45so812690pje.1 for ; Thu, 28 May 2020 09:12:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=k1Z8iFxUD0NAfMtU8SYp4KdvUR4mJqpxbiSADbFVZEo=; b=Ntyz900PB9gGjyVytcDgYbSiEJDOjqKej6g18lMvwZboRm8qsxABCS7Bb0Rw2SWaXa q20DaHb1a2vVkneARKR4/SSZbaboRQd0ZN/9Olh6iS9/HxqmS9KtCJW2XHgFsZqALryT 5Da9ee8Xe/QrtQeTuJhm+Wt72BNs4ldc+TGZG4vhoiYv0Cy5AnMVjuDN3vtJvpyAzCMN jJXKaGT3LSFtmzElZr9Ez4Gf0q5ODfgh+dLICgyG635Tm9b2uNV44OKbWI6hexiNV7Xs +jEQVqiSPFvWRtBU3T/Opq55eec5SfmIFKiRcAvW3s9ltVZoFPbp4daQTtHk5GFclcxA N28w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=k1Z8iFxUD0NAfMtU8SYp4KdvUR4mJqpxbiSADbFVZEo=; b=IowZVvPRwwrX60MdVtyK/weLjVnZgZu2kjiz3UA9tHrm3WZjzWoX36CP3metA0l3Kl RPLjAnGX0+aaR8burum6FlULpSwYkfCvv26o5QFrQEFdi/wXbIivegnmcDxawqTImHDB sQi5LFAvnOUw8FGFbHNB1y+vnwRZX1M3Ew165wHgmSnRf4OUZAc28QRMfXaoTLdmbEq8 9I78q95QJEcIxns4hRKFnh+tK4hD6l5tijL87SL6yJHqD02W22B/ttKHUuNwKTUcQQrG 1sZ66EXP6ursPFl4Y+gEsd6BYlmc0a6BYpOxgVwiCDaQDjrk9Bw4/+fIZYrou5VlqXxV DDFw== X-Gm-Message-State: AOAM531GgRfSAN5NBz6y/ra/8w5YwjyLehz1yyQobNTLtHhrMrUwpqhO UlbtGiGnyNNW4ZFV2IklBlcDoA== X-Google-Smtp-Source: ABdhPJwTzlJYhETfECo4NkeXabvCd2mb6ybjnVw9zc3+JRso42ldQNLQTVN65bJWs+Z0GItRgCGnjg== X-Received: by 2002:a17:902:aa94:: with SMTP id d20mr4089839plr.15.1590682366800; Thu, 28 May 2020 09:12:46 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id j6sm5088399pfi.183.2020.05.28.09.12.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 May 2020 09:12:46 -0700 (PDT) Date: Thu, 28 May 2020 09:12:37 -0700 From: Stephen Hemminger To: wangyunjian Cc: , , , , Message-ID: <20200528091237.7b87133f@hermes.lan> In-Reply-To: <768c74d06680b93b2ce6bbf0813d1910666888dc.1590666521.git.wangyunjian@huawei.com> References: <768c74d06680b93b2ce6bbf0813d1910666888dc.1590666521.git.wangyunjian@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [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" On Thu, 28 May 2020 20:03:07 +0800 wangyunjian wrote: > 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); This doesn't seem right. devargs is not filled in unless devargs is used.