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 852A0A0526 for ; Tue, 21 Jul 2020 19:27:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 72B6A1C002; Tue, 21 Jul 2020 19:27:12 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2079.outbound.protection.outlook.com [40.107.22.79]) by dpdk.org (Postfix) with ESMTP id A2EA7E07; Tue, 21 Jul 2020 19:27:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HGf4z2yQQco5W1LoKncqt/7/ktgZ1m8JtvL/WL7wm5E=; b=SGjaiS49EVG5lM69cNjNs1FMiTiRhN8maLa7cEFYxr/hLhIR0NVuYfWeob82M4iCtVl55YiD9KriBd3DmJANJdvWAmu63+V4X4hrMskOTeDXMi+eKpWcQ5rau3IDB05WlD868xSWatu9RFFP9/R6KNb/pLGlzMR6dqkRbxnobeQ= Received: from AM6P193CA0139.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:85::44) by VE1PR08MB5118.eurprd08.prod.outlook.com (2603:10a6:803:107::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.23; Tue, 21 Jul 2020 17:27:07 +0000 Received: from VE1EUR03FT047.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:85:cafe::ac) by AM6P193CA0139.outlook.office365.com (2603:10a6:209:85::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21 via Frontend Transport; Tue, 21 Jul 2020 17:27:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dpdk.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dpdk.org; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT047.mail.protection.outlook.com (10.152.19.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.18 via Frontend Transport; Tue, 21 Jul 2020 17:27:06 +0000 Received: ("Tessian outbound 8f45de5545d6:v62"); Tue, 21 Jul 2020 17:27:05 +0000 X-CR-MTA-TID: 64aa7808 Received: from 5bac6a548d42.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 811A1FCB-F132-4CD4-B3FE-25A3BD75237A.1; Tue, 21 Jul 2020 17:26:59 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 5bac6a548d42.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 21 Jul 2020 17:26:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G5TRSbcTCOzEK+3QVKE8ql8VOBuDqmBDkad1OyK1cKRQwrIZrXvLmh/4/pKBWy7c0v4XQxtPyhNx+THrbuRMuuhWrW5rUkPlin9gQxyu9cOIT1EHa8RVzy2bPC/4NcbE2LOdDBHRumEYLE6CLx512nicBlfU/5/8sgdP3ohfbBS4Mhcb5lrpgnrfr3waFBUMR9Nkm8k0AidfR8n6XkEhq2H5lyq2ODsM0kAnRQCDeBLVi2VLD2jpxxLzAc0ABw9InZsoo/unV3kcwj9yCkUCfnya1OZxUZC/Va/jwOOZw5jHEdtt2QTx1NsUu3N58UCdLHLU7DPtQuXF/mdl/csJpg== 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-SenderADCheck; bh=HGf4z2yQQco5W1LoKncqt/7/ktgZ1m8JtvL/WL7wm5E=; b=klNIfXAIhG1jXWSc0YGmp29H7B5BgIWZb/TGeME/s/E7C6r0ttDIvTzV4LM/9cQWSNjQ+mTgElIMrLBaER567/ru3fpSKKdc6Um7SKaqy0gyVn6ENKCYGJ4MZLLnlkjcGsgYp5HYgnsuJknTFxghuqizlV1EUUKOutZktpFzLltHr4yEKCCfx+FHHSaw1tETrnDRbFj6T8rjYfO+SMhPdmN56UIMiXYM2PQ5OT+UWoVVL4k7JMxZndcISgDM4IJ5DQdGKw7+lhYqZtc9ICVZPIjeYLnxyRO8S17phBhylkBL+UkeRXoe+/HerepbA7Be5ny/HmRQQqwMKHModwxc7A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HGf4z2yQQco5W1LoKncqt/7/ktgZ1m8JtvL/WL7wm5E=; b=SGjaiS49EVG5lM69cNjNs1FMiTiRhN8maLa7cEFYxr/hLhIR0NVuYfWeob82M4iCtVl55YiD9KriBd3DmJANJdvWAmu63+V4X4hrMskOTeDXMi+eKpWcQ5rau3IDB05WlD868xSWatu9RFFP9/R6KNb/pLGlzMR6dqkRbxnobeQ= Received: from DB6PR0802MB2216.eurprd08.prod.outlook.com (2603:10a6:4:85::9) by DB6PR0801MB1830.eurprd08.prod.outlook.com (2603:10a6:4:35::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.25; Tue, 21 Jul 2020 17:26:59 +0000 Received: from DB6PR0802MB2216.eurprd08.prod.outlook.com ([fe80::9d1d:207b:e89d:199d]) by DB6PR0802MB2216.eurprd08.prod.outlook.com ([fe80::9d1d:207b:e89d:199d%10]) with mapi id 15.20.3195.026; Tue, 21 Jul 2020 17:26:59 +0000 From: Honnappa Nagarahalli To: wangyunjian , "dev@dpdk.org" CC: "yipeng1.wang@intel.com" , "sameh.gobriel@intel.com" , "bruce.richardson@intel.com" , "jerry.lilijun@huawei.com" , "xudingke@huawei.com" , "stable@dpdk.org" , nd , Honnappa Nagarahalli , nd Thread-Topic: [dpdk-dev] [PATCH] hash: fix return value of null not checked Thread-Index: AQHWX2Njk9zMmmExek+h8Go88G37fakSRpVw Date: Tue, 21 Jul 2020 17:26:59 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: ece6cf73-fc91-4fa4-921d-8cca2112cf7c.0 x-checkrecipientchecked: true Authentication-Results-Original: huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=none action=none header.from=arm.com; x-originating-ip: [70.112.90.121] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d71dca8c-cc27-42d8-abfa-08d82d9b4ab0 x-ms-traffictypediagnostic: DB6PR0801MB1830:|VE1PR08MB5118: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:862;OLM:862; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: yfqFngoU+v1hHfga4CE3mJWgTyR89EZNafxsWv3GqKYM5fJo8qWb09gjFYeHtM5wmKtp6W5LNJ8zpou1SJKA3V/sujqwyUjs+JzCYnqaeyDXuF1xxhhLpy8Kg1lAHPFb+42k4v94HX4Yn8W7ybjipzosln2qGaXN0sWgCLiXO1uK/32DP6di/MiewLOjfTrUZ9yYWrNIhUDF6FWfS5nwoK6BA0QTrbWJP/dNpoMneffu/9B/3/DbZiGGX1CVMt1KaqPG/GLE6zhhxUL3HOvsndAPZ2jzZncCiseOMxQgrDDZcWAkzapfQfw1MIzjrR12aH3hK0zupI5TSx4tuf7dcg== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR0802MB2216.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(39860400002)(396003)(136003)(346002)(376002)(55016002)(5660300002)(52536014)(64756008)(66556008)(66446008)(66476007)(33656002)(478600001)(71200400001)(4326008)(2906002)(54906003)(8936002)(8676002)(76116006)(9686003)(66946007)(86362001)(6506007)(53546011)(26005)(83380400001)(316002)(110136005)(7696005)(186003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: OYVur4BOG0Ebe+ZWE/5US/TcTKWd/oiJ4orJtEER7BHSmvDRSjDEDzes+I/0kE9AaGaxIwB/In+MVuWAiJ10eGJzJARLDF3Vbehy3YQzlK/uLzP+h7j354RFBfyvRyYcB4fvFyQr0DhDz6kfaNxJtUSwEjIqX9M5l8W+44oizvqj3aJm05CBe+vMfcZ9gu1wdMBTAN3OuYZfyEu7/wLn6kx2MEUoStAHXWcadnvg5v6iZgSoWfakcc9BzF7SZsyDjrPP8gIcFRueSeqt+jO1mOqzyrAkEmlMeIpKTHXD4szulok7ySy85c/MZUJS0Sv3Lhlib2a2oHq8EYlj6NN15/ACE4GEZJIeGFV9bism2jrBUMKpl07n/JWchiWbrv1EMfRjiA/Z9AorZwoeKe1XAFEVhKfTm6eZ0A2sIilwypPsWsBR9J9j5kjxhDRNI2jp5u6xVp1MC9Cq11cP1idA4ATB2YTGdDvSahZJDIXZsMBaPkT4MpceW/H5kkqH++bZ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1830 Original-Authentication-Results: huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT047.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFTY:; SFS:(4636009)(346002)(136003)(396003)(376002)(39860400002)(46966005)(7696005)(5660300002)(8936002)(8676002)(336012)(52536014)(2906002)(33656002)(4326008)(26005)(47076004)(53546011)(450100002)(86362001)(316002)(9686003)(81166007)(83380400001)(186003)(70206006)(356005)(478600001)(82310400002)(36906005)(110136005)(6506007)(54906003)(82740400003)(70586007)(55016002); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 493e0a67-fb82-4493-bf8f-08d82d9b461d X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 129eZI9DPRhGgO0QBMwXkg7NwakVJUX7DfvLMLsnA0nPIoe5GWhzQZw890l8Sce14wqJZYgckxKNek9aAGmHbv6MkC4a53+U2NY5EYFaECOCtuK0xC6UwRPhFY34zDnS/ZnEKDlb32Ywb5jVJcenXCKuM+e/sfLQ/ciTkE74dZV8cvr9X6F8bwgAUtvrsJWyfYJ9ucuDiGkP0hf20T4azpgB617tQ0Z/OLfiE8OFxSqzLexN4DWnAObsCHrLGHLtphFJoI2I5xyXu3VGkuljkrNqgLDpfMG6vyyPUZCh+5zCHGihje1hjIT2NSyH6xG3Z8qDkcqL23Aw0F1y7FmrOSZ3K0tLA3apygW9qBIYP3jRsj7p/GwMvUYHbNA5oB3E29TVpiynvjJX/Jv2XN1EiA== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2020 17:27:06.6378 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d71dca8c-cc27-42d8-abfa-08d82d9b4ab0 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT047.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5118 Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] hash: fix return value of null not checked X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" > -----Original Message----- > From: dev On Behalf Of wangyunjian > Sent: Tuesday, July 21, 2020 8:32 AM > To: dev@dpdk.org > Cc: yipeng1.wang@intel.com; sameh.gobriel@intel.com; > bruce.richardson@intel.com; jerry.lilijun@huawei.com; > xudingke@huawei.com; Yunjian Wang ; > stable@dpdk.org > Subject: [dpdk-dev] [PATCH] hash: fix return value of null not checked >=20 > From: Yunjian Wang >=20 > The function rte_zmalloc_socket() could return NULL, the return value nee= d to > be checked. >=20 > Fixes: 5915699153d7 ("hash: fix scaling by reducing contention") > Cc: stable@dpdk.org >=20 > Reported-by: HuangBin > Signed-off-by: Yunjian Wang Good catch Reviewed-by: Honnappa Nagarahalli > --- > lib/librte_hash/rte_cuckoo_hash.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) >=20 > diff --git a/lib/librte_hash/rte_cuckoo_hash.c > b/lib/librte_hash/rte_cuckoo_hash.c > index 5f701d579..0a6d47471 100644 > --- a/lib/librte_hash/rte_cuckoo_hash.c > +++ b/lib/librte_hash/rte_cuckoo_hash.c > @@ -151,6 +151,7 @@ rte_hash_create(const struct rte_hash_parameters > *params) > unsigned int no_free_on_del =3D 0; > uint32_t *ext_bkt_to_free =3D NULL; > uint32_t *tbl_chng_cnt =3D NULL; > + struct lcore_cache *local_free_slots =3D NULL; > unsigned int readwrite_concur_lf_support =3D 0; > uint32_t i; >=20 > @@ -383,9 +384,13 @@ rte_hash_create(const struct rte_hash_parameters > *params) #endif >=20 > if (use_local_cache) { > - h->local_free_slots =3D rte_zmalloc_socket(NULL, > + local_free_slots =3D rte_zmalloc_socket(NULL, > sizeof(struct lcore_cache) * RTE_MAX_LCORE, > RTE_CACHE_LINE_SIZE, params->socket_id); > + if (local_free_slots =3D=3D NULL) { > + RTE_LOG(ERR, HASH, "local free slots memory > allocation failed\n"); > + goto err_unlock; > + } > } >=20 > /* Default hash function */ > @@ -416,6 +421,7 @@ rte_hash_create(const struct rte_hash_parameters > *params) > *h->tbl_chng_cnt =3D 0; > h->hw_trans_mem_support =3D hw_trans_mem_support; > h->use_local_cache =3D use_local_cache; > + h->local_free_slots =3D local_free_slots; > h->readwrite_concur_support =3D readwrite_concur_support; > h->ext_table_support =3D ext_table_support; > h->writer_takes_lock =3D writer_takes_lock; @@ -461,6 +467,7 @@ > rte_hash_create(const struct rte_hash_parameters *params) > rte_ring_free(r); > rte_ring_free(r_ext); > rte_free(te); > + rte_free(local_free_slots); > rte_free(h); > rte_free(buckets); > rte_free(buckets_ext); > -- > 2.23.0 >=20