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 2055642826; Thu, 23 Mar 2023 14:49:08 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A8C2C4021E; Thu, 23 Mar 2023 14:49:07 +0100 (CET) Received: from sender11-of-o51.zoho.eu (sender11-of-o51.zoho.eu [31.186.226.237]) by mails.dpdk.org (Postfix) with ESMTP id C3B304021D for ; Thu, 23 Mar 2023 14:49:06 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; t=1679579339; cv=none; d=zohomail.eu; s=zohoarc; b=VuMAbXO4dd3xXYdVy+qLtCep9frS+1TJrFe+Ges43drCBUoRUKK7ubVnJt58c2v+uFOnogGKW+SZrA8FuW1DiLEHPL1ReeqyKmPz36tr6l2k4NeymxqDXdK5uBgLKqc+JttE5BCCQKb7L1v2nfrPuzoXpdrPoyNEdGYyPWx/HII= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1679579339; h=Content-Type:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=ueaj5xwbHC9i0gWesgjJGhZMHLr4BvHE09TNvvu/YYk=; b=QjG/dNw3HuAc0MU6MxDD5FiWx5uDm5sw0tA5CKGvZ/SseNOy+hi9K4SzY29nOT9eyqfI/0D6rJyyOhnpAKGgcwxlzSn22OPBgDXqxj/REt6c48AkepejLEBWO/GVSg64oieCWNCXmIqwflkVldUZ6LswWdCz0UGamPqnMTs9ygA= ARC-Authentication-Results: i=1; mx.zohomail.eu; spf=pass smtp.mailfrom=liangma@liangbit.com; dmarc=pass header.from= Received: from C02GF04TMD6V (cpc92322-cmbg19-2-0-cust802.5-4.cable.virginm.net [86.26.35.35]) by mx.zoho.eu with SMTPS id 1679579337497635.7537692697441; Thu, 23 Mar 2023 14:48:57 +0100 (CET) Date: Thu, 23 Mar 2023 13:48:54 +0000 From: Liang Ma To: Chengwen Feng Cc: thomas@monjalon.net, ferruh.yigit@amd.com, Peter Mccarthy , dev@dpdk.org Subject: Re: [PATCH v2 41/44] event/opdl: fix segment fault when parse devargs Message-ID: References: <20230314124813.39521-1-fengchengwen@huawei.com> <20230320092110.37295-1-fengchengwen@huawei.com> <20230320092110.37295-42-fengchengwen@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230320092110.37295-42-fengchengwen@huawei.com> X-ZohoMailClient: External 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 Mon, Mar 20, 2023 at 09:21:07AM +0000, 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'. > > Fixes: 3c7f3dcfb099 ("event/opdl: add PMD main body and helper function") > Cc: stable@dpdk.org > > Signed-off-by: Chengwen Feng Acked-by: Liang Ma > > --- > drivers/event/opdl/opdl_evdev.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/drivers/event/opdl/opdl_evdev.c b/drivers/event/opdl/opdl_evdev.c > index 9ce8b39b60..f90d31aa19 100644 > --- a/drivers/event/opdl/opdl_evdev.c > +++ b/drivers/event/opdl/opdl_evdev.c > @@ -580,6 +580,8 @@ static int > assign_numa_node(const char *key __rte_unused, const char *value, void *opaque) > { > int *socket_id = opaque; > + if (value == NULL) > + return -EINVAL; > *socket_id = atoi(value); > if (*socket_id >= RTE_MAX_NUMA_NODES) > return -1; > @@ -590,6 +592,10 @@ static int > set_do_validation(const char *key __rte_unused, const char *value, void *opaque) > { > int *do_val = opaque; > + > + if (value == NULL) > + return -EINVAL; > + > *do_val = atoi(value); > if (*do_val != 0) > *do_val = 1; > @@ -601,6 +607,9 @@ set_do_test(const char *key __rte_unused, const char *value, void *opaque) > { > int *do_test = opaque; > > + if (value == NULL) > + return -EINVAL; > + > *do_test = atoi(value); > > if (*do_test != 0) > -- > 2.17.1 >