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 A353541EB2; Thu, 16 Mar 2023 18:34:31 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7BBE140DF6; Thu, 16 Mar 2023 18:34:31 +0100 (CET) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2067.outbound.protection.outlook.com [40.107.96.67]) by mails.dpdk.org (Postfix) with ESMTP id 3604F40DDC for ; Thu, 16 Mar 2023 18:34:30 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TR8BNxf2O/cAVuRwF0OEhoOFIpbVxwOR0Ydpe86rc+fmjHiCZAiLP82cE3twU6cVQu6CNFnnNEGt8nZda3G2UvNGTrt42vmjS4FYo075kGHWXeOkDqlfR2tc0C7tp+xNVrQuyFLrciVG2iDEbk11mRCuMdx+2H5YYPqy7WjrVw8eBlZdsZxPbOGr6BTh2gSFmc6z4+wqd3PYWSLFGfCMGpQmX9yXYlPlKQwolEoZcXtDqlzFYRta3alP9ZQeetNAlraB3hYp2/w5r7NIDRT1iEqn//Hc9tugD5q/9g38QhvDc6zyUEYl8R1m/E2ONZQ/zTQv0nXAXnDMETqJwHhcTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=N/crOwqFEpUV/fk/1hpzoJz2g6KhJXbpvlduUxyvYgc=; b=aqSwESrmtvVkdTWhC8AM0YUG3zTMiBPJGlhsdbMgZnWrfgXwxVx8FVX+yFXaYQOOKoFXdb1yBjUa4pqV7RMlL2CwJ/NQ0LzPnMj/B2PgA4VhzIDrA6d58EgtOw/9T8aHQOZpooAyqilpHRsyLTIlsjuA/Y1+40nzNavLt+w/OAIdAfaJwTFDYm9x0CWEcMOApCCKZ02VQB1rYMtuRfkYhM20y/YnsC6qLnR+EFW/Omeo8swLLgvXFjeHvmcsT0ABTIRd+jeeIboWSvqW96k8i0+5rLdHrn5jU3g+1XWGKpwiPn5ceeWcWxTPvXbiXLgob1mbKvvzhj2JwC0lwwjirQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N/crOwqFEpUV/fk/1hpzoJz2g6KhJXbpvlduUxyvYgc=; b=OJSIuI6uCjZhTyC2GHq9UlRAcDqGueJALXNk0+mOhuTdtSls1sB0zYWd8JU+QoIvrVt+nBlhrPch034jI2nXwvMJeS2B5uXxZsi12pGukBsY6WsWPiVpHS9gvSbI2aE4TkRJU1tm/FGvQmFPkAMAgOK3DgM4Y9zONVhMJO79oR4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by DM8PR12MB5496.namprd12.prod.outlook.com (2603:10b6:8:38::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.31; Thu, 16 Mar 2023 17:34:28 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::dd5a:8a5c:f493:9640]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::dd5a:8a5c:f493:9640%5]) with mapi id 15.20.6178.026; Thu, 16 Mar 2023 17:34:28 +0000 Message-ID: Date: Thu, 16 Mar 2023 17:34:22 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH 1/5] app/pdump: fix segment fault when parse args Content-Language: en-US To: Chengwen Feng , thomas@monjalon.net, Reshma Pattan , Stephen Hemminger Cc: dev@dpdk.org References: <20230314124813.39521-1-fengchengwen@huawei.com> <20230314124813.39521-2-fengchengwen@huawei.com> From: Ferruh Yigit In-Reply-To: <20230314124813.39521-2-fengchengwen@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0454.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1aa::9) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|DM8PR12MB5496:EE_ X-MS-Office365-Filtering-Correlation-Id: 704ef2b0-9d37-4dc8-d5bf-08db2644b18a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XrU8e6tS4u6wSQ9QHfvY2ls7Su/aCyvL6bRH6BlhtlCsHguoVMDEH+tpycn3xMFfDmfhIfBa2Lt1qHbH7Ktqnwk+io8w/L+tNAx8LLj2USaLJD2unnmht4XvD8SKChFG2O2XodxHg0/JLTat8F8EAs4UIXWI2SQJHmP5LcaP/iSF73ShGo6VsF4zZ17SpRpF24ZkBOZWENxAM6HQ6k0NImEC0R9eqx/m0ACygDBshmojPbwxH/XvDJkHwUdH2WZ2dG5It+r8dKEzrSe2zKXUZ7zQUwFzMfXEAMTsJ42UNNgBASNoB5gH6rr2JIDFJdzXjHNTa+NiJ3s6vlqynznH+VnL7AB00gdpqMhvnvCOHA7kNyzNWRNoqudP+jm7xmDbZnm34LDbZJoRmeoWG+8rSEsoO2RTWqU955iS/urFgsnNlLgi1NRUOUaulqr7AHlcTSP0Osu+qK4pis6XxPfWd8wG+ttmH+uruo9IwCzZtZHCuNa2HLeij50AmXs7AvDwVz4woS8Vmx1Q/PhfwKuFGtFl9A7WhShnJdr239ZCWFlpUs7A5GNlq6x4+8Vs2xPaNS9HMs4fN/L9H0Pu5DAO/hcawTFb3Rd+tgbl+kHq8cgyl0pDKSmT6+yarrvHHHN6ofk3y3LfXJ1cMHnqohn9h3W1g7sP/oOMrKGjRvJvZhRJuDlaulc922JMtFX1lhBnToKxhf8vlLZ6aoP4bHeUjCWBcH69Iqk8Aa5z49a6FVI= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(4636009)(396003)(346002)(366004)(376002)(136003)(39860400002)(451199018)(36756003)(6486002)(4326008)(6666004)(478600001)(66556008)(41300700001)(2906002)(8936002)(5660300002)(8676002)(316002)(66946007)(44832011)(110136005)(66476007)(31696002)(86362001)(2616005)(6512007)(38100700002)(26005)(186003)(6506007)(83380400001)(53546011)(31686004)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?NGVJWHg4ckEydnpNeVNBY1BadjBRc29qUitONW0ybUtRM3ZaS2llNmFXRjNi?= =?utf-8?B?RHhuYWtVdVhIRFJFUk9uMWVPbGV5Wm1sOCt2NTVXWlVQc0ZldjJ3M3FLYzc5?= =?utf-8?B?cUZFdUhVUU0xT2lEYkJBc25NbFBrZTRuUEEwMFcxMERRVjQ5bktIVnpkZ0d4?= =?utf-8?B?UTVPc3lZanlrNkRVTnNUM3pXNDhQcUV6bzZVV25ZanVNSk5KYzNHaXVVb2Qv?= =?utf-8?B?UGIyRzNWYnNZNkNOTWo4Vjg1Wlg4eGR6dGpTT1JNQTJQc2paZmw5bytVbjRj?= =?utf-8?B?T3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VN1?= =?utf-8?Q?FRzDh2ffuo5pLbnTrvlDEX8Rf?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 704ef2b0-9d37-4dc8-d5bf-08db2644b18a X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Mar 2023 17:34:28.3854 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zKs1Cmt5u0k7KdB4qwtsbwUjQDXoJuzUrzLUH9Zwwq4P0Rq8eFBvL+XQGpzEc1MU X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR12MB5496 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/14/2023 12:48 PM, 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 --pdump args with 'only keys' > (e.g. 'port,queue=*'). > > Fixes: caa7028276b8 ("app/pdump: add tool for packet capturing") > Cc: stable@dpdk.org > > Signed-off-by: Chengwen Feng Hi Chengwen, Thanks for the fix, +1 to patch. > --- > app/pdump/main.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/app/pdump/main.c b/app/pdump/main.c > index c6cf9d9c87..d286952483 100644 > --- a/app/pdump/main.c > +++ b/app/pdump/main.c > @@ -170,6 +170,9 @@ parse_device_id(const char *key __rte_unused, const char *value, > { > struct pdump_tuples *pt = extra_args; > > + if (value == NULL || extra_args == NULL) > + return -EINVAL; > + Do we need to check 'extra_args'? It is not something changes in the runtime, functions provides this callback is local to this file and in control, also if 'extra_args' is not provided correctly it will crash immediately so easy to detect it. But +1 to check 'value', since that depends what user provided and need to verify user input. Same comment for all set.