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 3068CA0032; Wed, 20 Jul 2022 08:29:10 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CB39E40697; Wed, 20 Jul 2022 08:29:09 +0200 (CEST) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2084.outbound.protection.outlook.com [40.107.101.84]) by mails.dpdk.org (Postfix) with ESMTP id 6E2B84003C for ; Wed, 20 Jul 2022 08:29:08 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bl4FxaPW8GwpFW8HxL75ZfW89vaAyu3iULeAarDlxygU4/UaRTPwWDRHx4N+KnAGxa68POqODfIg0xDT1/JU86MakuFfpNrh9Vxx1yEryDAmARELENnJLzI0cyhw8DQC9tqXToPqcRv3FH2BIUNPqpCOLmGXFSc2SJUFHvqA/+RParsr+VQ01HMmsRBR4Eodu/pABdi1NXcIZOPZfpX/UppvDYNq1TBAVEL+oXiPIBQoII8Uluo0KZRN/a2hkDPYf8m/mMlcVCZ4+C9C37dnutvXqMnD9V4IbwCIL05jz5o2j6YpgQaG497M2FDE+dxYsQxJUN6t0PDdwR9fQficvQ== 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=jpejuaXoKIR8EWeBSgOq6W0zQlIUgnJ/xs+Hep0pzMs=; b=Rqb1EGXTB5Nze+v+TBsDr+6clMlnCApNWWlCkRv7i5GvkLmy4GJRNSt69wf36uKg5m4CKcIrAb9JrKfC4ZfPTXdEOFeq+NsScBXEHCz2rGAJeL+iDXfHBjozioWtrvpkKR7rOpaqjDp3lCQoWuaq+zm5PE8dTzyUAhLMMjcjBe0oxOQQ/0vVGG/ght1o1CqlzWk8K4mzeqIZ1SiA0W+pf3QOWFG5bSJga2lDJceBZE7PmxOYBZFApNHoWFIM9Env4J2esX5/VrIL71auBksOicUBEz/lSHU6wGteyEZIoPk1f9cIRlfPsaFEZmAkjoy+XUDpj/Pt5ceC2fTHik55ig== 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=jpejuaXoKIR8EWeBSgOq6W0zQlIUgnJ/xs+Hep0pzMs=; b=2BS6LuoTO7VEiEZgtS4+tqg9v4EBlDWF/QFaOLAyeQBZQPqoquMPxjuVLObBlhJS6cR2pi4YLyGxRLKsTHsu8YmEy9fJIqdhEZ/uzF7/rLPaf+2TI1LTAR8Omq9ffIaHPvMSwKGDfOZbCSABZcGP85hZTMmhj5caosgTJ6Sx3AQ= Received: from SN1PR12MB2544.namprd12.prod.outlook.com (2603:10b6:802:2b::16) by BY5PR12MB4035.namprd12.prod.outlook.com (2603:10b6:a03:206::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.14; Wed, 20 Jul 2022 06:29:06 +0000 Received: from SN1PR12MB2544.namprd12.prod.outlook.com ([fe80::2dd4:c9c8:2b74:c21a]) by SN1PR12MB2544.namprd12.prod.outlook.com ([fe80::2dd4:c9c8:2b74:c21a%3]) with mapi id 15.20.5438.023; Wed, 20 Jul 2022 06:29:06 +0000 From: "Namburu, Chandu-babu" To: "835703180@qq.com" <835703180@qq.com> CC: "dev@dpdk.org" Subject: RE: [PATCH] crypto/ccp: Check for the NULL pointer after calling rte_malloc Thread-Topic: [PATCH] crypto/ccp: Check for the NULL pointer after calling rte_malloc Thread-Index: AQHYk4NqTgg4Rxk0nEqi/N5ouOMVUa2G3NGQ Date: Wed, 20 Jul 2022 06:29:06 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_Enabled=true; MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_SetDate=2022-07-20T06:28:55Z; MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_Method=Privileged; MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_Name=Public-AIP 2.0; MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_ActionId=df703fe2-4925-42f0-877c-6411b7d0f3fc; MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_ContentBits=1 msip_label_d4243a53-6221-4f75-8154-e4b33a5707a1_enabled: true msip_label_d4243a53-6221-4f75-8154-e4b33a5707a1_setdate: 2022-07-20T06:29:03Z msip_label_d4243a53-6221-4f75-8154-e4b33a5707a1_method: Privileged msip_label_d4243a53-6221-4f75-8154-e4b33a5707a1_name: Public-AIP 2.0 msip_label_d4243a53-6221-4f75-8154-e4b33a5707a1_siteid: 3dd8961f-e488-4e60-8e11-a82d994e183d msip_label_d4243a53-6221-4f75-8154-e4b33a5707a1_actionid: 9cd977b4-d959-4485-b6fb-edf61c1f4ab6 msip_label_d4243a53-6221-4f75-8154-e4b33a5707a1_contentbits: 0 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1943e853-32d5-4163-b419-08da6a1925a2 x-ms-traffictypediagnostic: BY5PR12MB4035:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: MEhm+9EMNqPiiBf3KiR2NCpipUKGdOmcA0DGj2L8WL1n2jeoPsiW7TmGmRGRY0lRqJ7y3kmtSyHS+WaR1VcxCQk/vAL4qAfhpA6rUYfPkjNq3dwZ7YEJSZn/nqgIxbhaHyHicITnoLH+9WbprmzD1aJ+sIrq8orzZglPOdSxIrsQkhyKON2geOIWeSirqJglWrKp9dVFGDDR/tWRUNX0gyxF+8lmDffxhKhoO7Ei+BO28N4NTeRA/PzLacWxqGB3Qukw8ICOvC0QeGDjrIrfXmUI7Ai8VRLw+BkVh04+2aujTKlK3jMa6ISDhDUTwofim8R9nk8BYaZc2b0HGz6x/70hpxofj1rHjKEJT/tWJAPTg0De5GNIeEz9SfanDh09pGi+cvFdw4xUKMoTDUDjnCLe/UStz8BYOBzmuKbie3zIgqwIt3jEvm3hLgzLCPgfX4QL3cFou4qNqnrOQpmT8hrVRSmi/3gAArDosqNqFArh/FORNTJwxhBryJ8yno1Ko+6tozVDLgnhebj08ct6motQ2pZMe+eG66uTBzSQuRpDdkHjkYdk3KoOcdxJMuJYsTxDtjdJ1vwS3ghjadtPeIE3Ai8JrqGTdqClDR3BAi6bCvIsPVh4Cg3/xUGFxZ4g/cAlW0ubLusT9OrzheYJ5d0owo3Ri5HzvRlYGGTB37c4z1f7kYnrkvtYQg3z86sEBikZiYoS6J/glnLt2MlEQPWfOG8XpXpZQLgVgOzBFAYh9eY6whJsPT8Q7Y+iD+T54/ycJXZfpW3qRjEwz22l6DGADmp9umfEsPeWHn0R+6TY+Q7zEJh0OlYqewoDEstH x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN1PR12MB2544.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(396003)(376002)(346002)(39860400002)(366004)(136003)(53546011)(6506007)(52536014)(7696005)(66946007)(6916009)(9686003)(76116006)(478600001)(41300700001)(33656002)(71200400001)(316002)(4326008)(8676002)(86362001)(66556008)(26005)(66446008)(83380400001)(8936002)(186003)(64756008)(66476007)(38100700002)(38070700005)(55016003)(2906002)(122000001)(5660300002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?x0w2LyRGV+5dNun3P/cfSlICmwvjVDjaR+d+kzjx2ezBz82DJdMPfnOzMapd?= =?us-ascii?Q?qDNGUMQeVdrSSjYOePcW0/MjtQP25ToShRjr27R7w5INzZiYn1llGgqF6bT9?= =?us-ascii?Q?/8HXHqDN4C/D4qH1big4Xb0OQ36RNdLo59US4HABWMs0Km8DG98iXI/XVeFw?= =?us-ascii?Q?o0zEexiL91qp/A+lfTGx5qyWwDKFoFvn4Tcg2mCR6oZHKeV/md4UFqpo9V/3?= =?us-ascii?Q?kEFRWpev/6xjkIBczhij1J5dOJESfl72ClNdZWERKbz4CgK7F2PdeKrH8PT6?= =?us-ascii?Q?tS787aQRq+HzfAUgeU9osT4kWpzZ3RIpXxjNoylPxdhYd8fBrcSpoF81DEpL?= =?us-ascii?Q?jsHWLJUwcN7BXtxJiprp/BYi+7MDryERP7QknFAZY3Wtdv7MWn/iW88H/tGm?= =?us-ascii?Q?MIdias/uIG4iS6K5V1zrnrNunuP+addrSHxbIicmq6/XnPAWzwSSqlwFuF00?= =?us-ascii?Q?5N4a4UworATBpumw2TAN4bTZ0FO2hTdP1mF4LpBA/SdfbgNSIp9dW3Dr1w2m?= =?us-ascii?Q?0gIYA2ZZ0xfeb1xf7skSm8HiVKsva51cUHNtYVAdksW8x6RpPccBkwSqF141?= =?us-ascii?Q?y6xam/+s7BH9Eb7gRcULY9rbUaAzFpN14DVV+GU2RewY83kLRCM8uQxok6Vx?= =?us-ascii?Q?NlJMpt3XyLd/UJ4Gjg6c+YcKmtYY6HbJ+M/6a4bJPNyADRE2uL2czfz4WI5m?= =?us-ascii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Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN1PR12MB2544.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1943e853-32d5-4163-b419-08da6a1925a2 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jul 2022 06:29:06.3868 (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: bAxiaB2td8vU+IINp0EHOh6DE+Ua0N+XdZk/IX/NI47zOuTtfsBHKPTncidLQ4Ap8NGB+jBJDApKPrqG3TEd6A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4035 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 [Public] Acked-by: Chandubabu Namburu -----Original Message----- From: 835703180@qq.com <835703180@qq.com>=20 Sent: Saturday, July 9, 2022 4:31 PM To: Namburu, Chandu-babu Cc: dev@dpdk.org; Shiqi Liu <835703180@qq.com> Subject: [PATCH] crypto/ccp: Check for the NULL pointer after calling rte_m= alloc From: Shiqi Liu <835703180@qq.com> As the possible failure of the rte_malloc(), the not_checked and checked co= uld be NULL pointer. Therefore, it should be better to check it in order to avoid the dereferenc= e of the NULL pointer. Fixes: 09a0fd736a0 ("crypto/ccp: enable IOMMU") Signed-off-by: Shiqi Liu <835703180@qq.com> --- drivers/crypto/ccp/rte_ccp_pmd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_= pmd.c index a35a8cd775..776f928864 100644 --- a/drivers/crypto/ccp/rte_ccp_pmd.c +++ b/drivers/crypto/ccp/rte_ccp_pmd.c @@ -301,6 +301,9 @@ cryptodev_ccp_probe(struct rte_pci_driver *pci_drv __rt= e_unused, }; =20 sha_ctx =3D (void *)rte_malloc(NULL, SHA512_DIGEST_SIZE, 64); + if (sha_ctx =3D=3D NULL) { + return -ENOMEM; + } if (ccp_pmd_init_done) { RTE_LOG(INFO, PMD, "CCP PMD already initialized\n"); return -EFAULT; -- 2.35.1.windows.2