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 7E86345904; Wed, 4 Sep 2024 19:29:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 87C7E427B0; Wed, 4 Sep 2024 19:29:05 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) by mails.dpdk.org (Postfix) with ESMTP id CF2404275A for ; Wed, 4 Sep 2024 19:29:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1725470943; x=1757006943; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=ePPBETvKs/a9XUect+z3mCd4e6YIgIsoNNtXxGLQ1VM=; b=hwBoh5J0V9kTHrzCzRYXRp4dUCZr0shhFPYziw41DgT6hGjR2mZuD84H CA/U3jjVZT8rsxDkVa1RmmL/PWTfkdQHttAcJrLYV692gEzznHv8XFNUt nehulbS5hmB3d55iJUJuY6WAODsTe4BrASsZqqzPzHWsOzbzOnHtp/Yks Bp17Zl3rS5dQsWJkIasfpqCJFDzMZekR5cm6A4NX+AGUeBdX5mEu5AFGX AofyWsX5PUDkiB2++YJ7MrlW/mezq/OkfbnV9NtlCCqWCVPCX+TZuBajk 5J6vgeSB6rKPYIiYSwNBa7jlON2X+QCGQMFVLKMN3ut7vero7rTl8Lar8 w==; X-CSE-ConnectionGUID: oggUNE22TWa8kzTWUgJncA== X-CSE-MsgGUID: XR1ylylyR5KTGeYfgnhtHw== X-IronPort-AV: E=McAfee;i="6700,10204,11185"; a="24262851" X-IronPort-AV: E=Sophos;i="6.10,202,1719903600"; d="scan'208";a="24262851" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Sep 2024 10:29:01 -0700 X-CSE-ConnectionGUID: zWyN8wRbQzSunn3buMubuQ== X-CSE-MsgGUID: ym6MnnYAQfW0n4X0Rx7oqA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,202,1719903600"; d="scan'208";a="69499721" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmviesa003.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 04 Sep 2024 10:28:59 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 4 Sep 2024 10:28:58 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Wed, 4 Sep 2024 10:28:58 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.45) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 4 Sep 2024 10:28:58 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TKbdFik1c0DABg2PpIuYdpyafDVck15EttuCZ6k+OKc12OKMO/MWgrKMhXxnY3jNI/28vDj6y1x6lq7XlhN/TPYk3OJcT6XYpW9URIH/ewWJq2awuuXvITut/WmSyeVBZhKsKSAL3RuoJvxHN9k9MtHpqjtTB3H5PHaNNcKKDhBFFi3ZIYb4Z7xsR3Myyu7sdHxDtXydxcB56ZD3/too9/m0/TxQBXqjr8XHyl1H3pTur19SFqfLeqvinXhpPgRbwZcSqwXvOgTSy9dUigcgWobRVfuGaukW42B8qHd6ajx+cH10NArWq+39jjkLMb7ow6OqSUyVhEURVa8S7tOo3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=MHe10c1xh/yUGoEFFjST3nXnlvrORfbUpEnOS88yV1k=; b=jJ5fdfrxrxITjuhxEN+Fk3QphxnbLYrYF3kBfJmHALHFZF+fR8vo707DkFbicJifU9H7lcOp89/3e9W7p2fUF9Z1WFeo0pKwu8iv+Rynptlh7DMynLyivsCnZ8JebOFjQ8zoUQqhXR4v14pq5UxwXeOIof12Tntmr37K48UDTW+eE3VcMw/TJGilPw8e5tFcRzXGf9twwHh5VojKVp1T2OpD16jDVAjuI9TXm4yU8zcAfAlLA+PTVAJ0QJe+KOSoUlRp0OXIXy9n20l5ep9PIS+458moUePP0wyuixSSlN5tQnH3sFoCT3QRao3oxGwiok8gtTB1MYxQp62hfCKNIA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from SJ0PR11MB5772.namprd11.prod.outlook.com (2603:10b6:a03:422::8) by SA2PR11MB4777.namprd11.prod.outlook.com (2603:10b6:806:115::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27; Wed, 4 Sep 2024 17:28:56 +0000 Received: from SJ0PR11MB5772.namprd11.prod.outlook.com ([fe80::5851:319:3da6:850b]) by SJ0PR11MB5772.namprd11.prod.outlook.com ([fe80::5851:319:3da6:850b%4]) with mapi id 15.20.7897.021; Wed, 4 Sep 2024 17:28:56 +0000 Message-ID: <21f0dbf5-16be-47a9-8b98-629d655e0b8c@intel.com> Date: Wed, 4 Sep 2024 18:28:50 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] hash: separate param checks in hash create func To: Niall Meade , Thomas Monjalon , Yipeng Wang , Sameh Gobriel , Bruce Richardson CC: References: <20240726145443.1058676-1-niall.meade@intel.com> Content-Language: en-US From: "Medvedkin, Vladimir" In-Reply-To: <20240726145443.1058676-1-niall.meade@intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: BE1P281CA0205.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:89::14) To SJ0PR11MB5772.namprd11.prod.outlook.com (2603:10b6:a03:422::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR11MB5772:EE_|SA2PR11MB4777:EE_ X-MS-Office365-Filtering-Correlation-Id: f4b2b9b8-1cd2-4be8-102f-08dccd070db5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?V0lIbnhkRWQxQzBBektiemhDSVJXdml0MDErZERsM29EdGxzQlpPZ1o3K3BS?= =?utf-8?B?bCtFNE1zdGZEazdPcmNzSG41OVBxMGNaWlp1eGtyRFd6R3hiejJHQVdCazVU?= =?utf-8?B?NWlRWjNHdWphUG1NdmlyMmhzVmJMQ2xhWWlqTXpjSzZtcWtCQ00xaDZBT2xI?= =?utf-8?B?dG1rdWtkelo3elV6Mk9GclFlNFpLMncvMlBrVVdSM0trNitpOVpMVUVRakxT?= =?utf-8?B?QWlvSE9Hb2RWajgrL2IyTmtrbU9IdUtwUVZ4bjBOTE0vc0R5NFBUckZWYXVx?= =?utf-8?B?M1F2OEYxbnV0OS92bEphNm5xcmxyaHJvNUgvSzRBbGs3NGpIelA2RURSRVVk?= =?utf-8?B?V2huODUyb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?B?NG41S25WS0o5Y1JUUGZKa3FhNG5mcWlzZFA3UDZ6eVV1ZjMxL2xWZlFINWJw?= =?utf-8?B?YW53UUZnM2VxUmhQOHdmNU0xSkRxYmd6YitXRis0ekVWSEt2MzdrdCtXSjhj?= =?utf-8?B?MVdFYno3T2lGOUJDQzdDWWk1OXdMQlBzUGxoVmJlZzBPVXh5eFR4d0phTVhR?= =?utf-8?B?S2hPcGFCSUFDOEN3Y1RTdXpEUDBnVkFZOFdNOHBXZDRWcVNydHRkRE5qTjd5?= =?utf-8?B?cjVjVWV3b3EzUVNLN1cvMDNWSk1BR3ZwN0xKYUhoc3VNY2V1RUdUZlNxUXd6?= =?utf-8?B?c1pZb0dpRDdxcjJBRE1rczhLakJkRFcxdVFQTTJJN1lTbEh6NktSeFJ2MWMy?= =?utf-8?B?V3JXcmlNSFZYVjBBVWdwZVlnR2c4U3djdENYL0Y4aE5zYlpUNHJML0xEaFlI?= =?utf-8?B?bitjZ2llN1VhZFBuaHd6eSswRzFZMThQRmR5K3huZXB3TCtnQkJtQStNUm5W?= =?utf-8?B?dGtYRUs5U3JyTkNRczhZeW5vdmVHOHVLa29jMlV1SWtxMUNhekFXdzVoeHQw?= =?utf-8?B?NWZlRFZSNmt5OXhvT1ZyUT09?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR11MB5772.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?NitFdFBEZnJMajJBMGtEYXRMRDd1Y3c1OHlDaUovZDg1emNabWhmTGlGdDNM?= =?utf-8?B?dHlMbnRPMUZ5ZVdWK2hMNGRYTkNkK1RoektsbW5SVUpVWmJROUNwN2J3bkg4?= =?utf-8?B?anNyRCs1V1BkWTZRSEpBUXpqa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B?RUhidGRSYmhsL3dYUEV6b2lVa3B6NG1lTkh1STJVZmVHd3hoNUNkeFJlUitN?= =?utf-8?B?Qy93YmoxQXlFRkJZRUR2Zm1ZZCs5QmYzMDhiWVhRa2tzcElodGpvU3BOdW0v?= =?utf-8?B?UU9RKzcrcHVwTHgyR1lDSktRaklOZWhzUUsxclVQZXBQK3JhSXJweDA5QkJE?= =?utf-8?B?WWVDejU5WFUzUDg3S09mS1JsY0kxSzRlRXlmSjVuQnlndUxmNWV3bVZrQk5I?= =?utf-8?B?UGc9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: f4b2b9b8-1cd2-4be8-102f-08dccd070db5 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB5772.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2024 17:28:56.1071 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NNKVvOgJD5hGmLK9czUZsuVRchW56GOacsILoGyAQx/6DUgzrgyIh/fCBPqKZ1iZjbhL38GZzTihr0uRrSftQlvTFDlny1APBFihb7JiZcI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR11MB4777 X-OriginatorOrg: intel.com 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 Acked-by: Vladimir Medvedkin On 26/07/2024 15:54, Niall Meade wrote: > Separated name, entries and key_len parameter checks in > rte_hash_create(). Also made the error messages more > informative/verbose to help with debugging. Also added myself to the > mailing list. > > Signed-off-by: Niall Meade > > --- > > I had name set to NULL in the parameters I was passing to > rte_hash_create() and the error message I got didn't specify which > parameter was invalid. > --- > .mailmap | 1 + > lib/hash/rte_cuckoo_hash.c | 22 ++++++++++++++++++---- > 2 files changed, 19 insertions(+), 4 deletions(-) > > diff --git a/.mailmap b/.mailmap > index 8aef1c59a4..e2a1d55203 100644 > --- a/.mailmap > +++ b/.mailmap > @@ -1054,6 +1054,7 @@ Nelson Escobar > Nemanja Marjanovic > Netanel Belgazal > Netanel Gonen > +Niall Meade > Niall Power > Nicholas Pratte > Nick Connolly > diff --git a/lib/hash/rte_cuckoo_hash.c b/lib/hash/rte_cuckoo_hash.c > index 577b5839d3..97d55ca23b 100644 > --- a/lib/hash/rte_cuckoo_hash.c > +++ b/lib/hash/rte_cuckoo_hash.c > @@ -190,11 +190,18 @@ rte_hash_create(const struct rte_hash_parameters *params) > > /* Check for valid parameters */ > if ((params->entries > RTE_HASH_ENTRIES_MAX) || > - (params->entries < RTE_HASH_BUCKET_ENTRIES) || > - (params->name == NULL) || > - (params->key_len == 0)) { > + (params->entries < RTE_HASH_BUCKET_ENTRIES)) { > rte_errno = EINVAL; > - HASH_LOG(ERR, "%s has invalid parameters", __func__); > + HASH_LOG(ERR, "%s has invalid parameters, entries must be " > + "in the range %d to %d inclusive", __func__, > + RTE_HASH_BUCKET_ENTRIES, RTE_HASH_ENTRIES_MAX); > + return NULL; > + } > + > + if (params->key_len == 0) { > + rte_errno = EINVAL; > + HASH_LOG(ERR, "%s has invalid parameters, key_len must be " > + "greater than 0", __func__); > return NULL; > } > > @@ -204,6 +211,13 @@ rte_hash_create(const struct rte_hash_parameters *params) > return NULL; > } > > + if (params->name == NULL) { > + rte_errno = EINVAL; > + HASH_LOG(ERR, "%s has invalid parameters, name can't be NULL", > + __func__); > + return NULL; > + } > + > /* Validate correct usage of extra options */ > if ((params->extra_flag & RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY) && > (params->extra_flag & RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF)) { -- Regards, Vladimir