From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DB1E441E1C; Thu, 9 Mar 2023 16:21:20 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CD95B42D0B; Thu, 9 Mar 2023 16:21:20 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id D32CB427F2 for ; Thu, 9 Mar 2023 16:21:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678375278; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ny24GnWPO4cul9CgrmDgXnWqbr3LlmNB29eG7Gvj9VE=; b=U4A73blugOQt2GR/B/xbHHNZdmYPmqjkK4Kqw70M/7ee0Cf3IFXb4vb5XV5oZ4xFk/dksj AsUlR657jAZDuOVP0Ee1I1c8bsDFcG4POUICYWtq3lkur6Gw60+fdvARxwA8hGA0DFPzDw jGypYnIrsAyzcXXzumL4W+AqeRnrEUM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-641-t0-Daw5tMxmBJAT37Gkn1Q-1; Thu, 09 Mar 2023 10:21:15 -0500 X-MC-Unique: t0-Daw5tMxmBJAT37Gkn1Q-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D995785CBE7; Thu, 9 Mar 2023 15:21:11 +0000 (UTC) Received: from [10.39.208.18] (unknown [10.39.208.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1CD77440DD; Thu, 9 Mar 2023 15:21:09 +0000 (UTC) Message-ID: <20aae1d9-5da0-4a80-95ce-d2ced1ffa836@redhat.com> Date: Thu, 9 Mar 2023 16:21:08 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH 7/9] net/virtio: fix segment fault when parse devargs To: Chengwen Feng , thomas@monjalon.net, ferruh.yigit@amd.com, Chenbo Xia , Yong Liu , Ivan Dyukov , Ferruh Yigit , Xiao Wang Cc: dev@dpdk.org References: <20230302075012.32423-1-fengchengwen@huawei.com> <20230302075012.32423-8-fengchengwen@huawei.com> From: Maxime Coquelin In-Reply-To: <20230302075012.32423-8-fengchengwen@huawei.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 3/2/23 08:50, Chengwen Feng wrote: > The rte_kvargs_process() was used to parse KV pairs, it also supports > to parse 'only keys' (e.g. socket_id) type. And the callback function > parameter 'value' is NULL when parsed 'only keys'. > > This patch fixes segment fault when parse input args with 'only keys' > (e.g. vectorized,vdpa). > > Fixes: 4710e16a4a7b ("net/virtio: add parameter to enable vectorized path") > Fixes: 44d7b2e87b69 ("net/virtio: refactor devargs parsing") > Fixes: 440f03c25378 ("net/virtio: skip device probe in vDPA mode") > Cc: stable@dpdk.org > > Signed-off-by: Chengwen Feng > --- > drivers/net/virtio/virtio_ethdev.c | 3 +++ > drivers/net/virtio/virtio_pci_ethdev.c | 3 +++ > 2 files changed, 6 insertions(+) > > diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c > index 0103d95920..d10f42bba2 100644 > --- a/drivers/net/virtio/virtio_ethdev.c > +++ b/drivers/net/virtio/virtio_ethdev.c > @@ -2054,6 +2054,9 @@ virtio_dev_speed_capa_get(uint32_t speed) > static int vectorized_check_handler(__rte_unused const char *key, > const char *value, void *ret_val) > { > + if (value == NULL || ret_val == NULL) > + return -EINVAL; > + > if (strcmp(value, "1") == 0) > *(int *)ret_val = 1; > else > diff --git a/drivers/net/virtio/virtio_pci_ethdev.c b/drivers/net/virtio/virtio_pci_ethdev.c > index abc63b0935..9b4b846f8a 100644 > --- a/drivers/net/virtio/virtio_pci_ethdev.c > +++ b/drivers/net/virtio/virtio_pci_ethdev.c > @@ -148,6 +148,9 @@ eth_virtio_pci_uninit(struct rte_eth_dev *eth_dev) > static int vdpa_check_handler(__rte_unused const char *key, > const char *value, void *ret_val) > { > + if (value == NULL || ret_val == NULL) > + return -EINVAL; > + > if (strcmp(value, "1") == 0) > *(int *)ret_val = 1; > else Reviewed-by: Maxime Coquelin Thanks, Maxime