From patchwork Tue Aug 8 10:55:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Meenakshi Aggarwal X-Patchwork-Id: 711675 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50E93C04A6A for ; Tue, 8 Aug 2023 16:08:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231827AbjHHQI5 (ORCPT ); Tue, 8 Aug 2023 12:08:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231830AbjHHQHF (ORCPT ); Tue, 8 Aug 2023 12:07:05 -0400 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2067.outbound.protection.outlook.com [40.107.249.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 804D072BE; Tue, 8 Aug 2023 08:45:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fwheaBlZ7PxchftVGYJwCN3KldjzKTC1hnC42RKFp18qCfVVYmMhGv4Ly5TIElZr1gvnw8RAnGiFXlYnCfv6Oxl0DZkjmkbezd7+EU6L8yqtERI5SuL550Si7BtUcV+5VlyI9PVaAmHM7W0Z3IWUfM2geYfIX6xJc/JejoqBTRY7bsUrJiHTGY4Dvb2YgJtc1DPNosGINb759nhoZxtlwUDwJuSgQ9USh7gQZxkh3hTyx/2du1nwOwNwvYaGbN8eDCos7OTWGYymA3ZtobZqSCsDbwgmnWBuXW5Dyu5/4qDzTIr1zXYp7bcT3L4RWif3bgoS3soDSbFntMxPUTf1UA== 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=5PAZfZfCiuGzfNJVcsl890Sr7GdVY1xi9gw8RuV01ik=; b=JuV/9LbTdzfwWNvab4McNxlNV7wZolZqFSdoi0T6JZncSMojCTDaZ9WvBv9MefVlaHOYUxSwJVkhF6oH0REB9E91GZXbgtCmNZhVDLmdZ/Rxr9hO7TNJ2z4jN6mmGs69337oamhzuX3bhyUHDVJ9yVfcBk/JOKJb0vGR0H2OHMYnbx0yb4IZ+tefQrkrbGXtsPV094PvB7wECnqSh5ULMnFJ9nDXJ0lJn8JuhnSHf6KPoYb2VT9lAMjQvRBdWXj9R1C/gQiczb4tI1aTeUskncpC4hJRFHwhTfH3MBWNAEObLmP7GNQZySC/DybED2Ybgx+goz9RTa2ChDVufs9E3A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5PAZfZfCiuGzfNJVcsl890Sr7GdVY1xi9gw8RuV01ik=; b=ljjqzoH4k9T4LWVuiis71OBneTYDi9ROu8S7uj8biDAOOU26O6oyNFPglnAO/+Pbq2pghDt2v2+mT10EZ0mu9tXh29NOig2w4OfgK7BIpCKblW3/l8a5C/+tGj34qHuu9odamwyfW6qiMdZl15piSsFD1TchBB+yiOt0DIi5oBI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DU0PR04MB9563.eurprd04.prod.outlook.com (2603:10a6:10:314::7) by AS8PR04MB8101.eurprd04.prod.outlook.com (2603:10a6:20b:3f6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.27; Tue, 8 Aug 2023 10:55:46 +0000 Received: from DU0PR04MB9563.eurprd04.prod.outlook.com ([fe80::15ed:8451:b0a2:ec64]) by DU0PR04MB9563.eurprd04.prod.outlook.com ([fe80::15ed:8451:b0a2:ec64%4]) with mapi id 15.20.6652.026; Tue, 8 Aug 2023 10:55:45 +0000 From: meenakshi.aggarwal@nxp.com To: horia.geanta@nxp.com, V.sethi@nxp.com, pankaj.gupta@nxp.com, gaurav.jain@nxp.com, herbert@gondor.apana.org.au, davem@davemloft.net, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Meenakshi Aggarwal Subject: [PATCH] crypto: caam: fix unchecked return value error Date: Tue, 8 Aug 2023 12:55:25 +0200 Message-Id: <20230808105527.1707039-1-meenakshi.aggarwal@nxp.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: AM0PR04CA0028.eurprd04.prod.outlook.com (2603:10a6:208:122::41) To DU0PR04MB9563.eurprd04.prod.outlook.com (2603:10a6:10:314::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9563:EE_|AS8PR04MB8101:EE_ X-MS-Office365-Filtering-Correlation-Id: 6171de5a-3049-425e-3157-08db97fe0489 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XXDzZE/KIyrxLlG4UOtN/OAZ3UWZXbzy0rnAqb32bq62g2oLvEkjBdcxKstzhng+wdnMH2BkRzlAvwkmPwl4NwNVrjyDzitkCvtW+WCnPaNSkI5gP5PzwyNJ/lb3P2w7KtkkWJ86Ew96Oc4BCxeIZS0Z9wpCLU6MlVrDrl+HmXTFq1xRgf3zSZ34XcFefuhwus1nPIDR29L4atgtYBf9dKY+YqkEtic4r/d1vUXbOoKQRWjPixryu2kb+CI7K83F1HprLPJxMIR4uCct76kJYZykwr630Stt8Xl0krSX5OZTCIgcVBpkt2ex9RGk26JY8fdlhssRT23Q6By99MEjv78+92mGwEoocNaoi/Ve9rpA+GJYOD/KHGpeZg4pCIYq5/w15zDxfIan1PYO0Nkp5xcL1xtUJOSWkuP1i+G9ATTsZGfs3qPT1o/R3bTmtXxdIswiYuH2mcbArqRnVSIclPSaJYto2Z1k5jNA3/uHkSIjgD1Qa70k86eAB9VEqngn77gcaMwOw19Zi04i26xVnXMGfNVmGmZWySOF4lMi219GwyhpKX6NG9tuUSkJq8I+IQjEQQ2aPNSFCypnt8cy85vJj51Ivl4am8LXb/N4eO1nz0gOVOCYhxz8+e0H804k X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU0PR04MB9563.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(366004)(39860400002)(376002)(396003)(136003)(346002)(1800799003)(186006)(451199021)(2616005)(6486002)(478600001)(83380400001)(66556008)(9686003)(6512007)(26005)(6506007)(1076003)(66476007)(41300700001)(8676002)(316002)(52116002)(8936002)(66946007)(2906002)(4326008)(4744005)(6666004)(36756003)(38100700002)(38350700002)(86362001)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bCey8oItM4z5Sh5ReMRC0VECbIjfA4Z+bc9jY7mfqXPNc7okkJfY95LbyND6pKUyDpI9Rk8BMia45n24hByP1m+GvZrsZeUToRQ2duIM0KA2hxq+wlP6up/8C+fcUsWlsOpVlnBqqQgAH4XlyNdyJPvje85SX5mOYbvmSQ95ku/c/eHA1CFa4P/yWTxUI60nTSOh0QipbMP1kAhwMy2ze1Js5PRMbW+crDLUsD0plhGQ94ZVBN6BqTz7sYn9+kjxeR9MeHt0BzZpfMn5h3FfUwm80HD/GM3m454bjIGO386cUxnfqfnGjoZRZ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F2ncIXhc9AV89NNoD8X+GGKkJXXtGPRBFSK7xat0Q0/PYOnwABJCEsIBxsBN6QqPRXQUQ76vCFnrTKzLLenJEafaB+13Sh0EcgFsSp2g25Dbt4EL5vWR67A7JYYOcy/OXfgjsj3/e5Hp70IXQUscBjGc08lmFqAmqSn8QX4qE+6f/EBESPK1BTbzKEaDRAZqYg3h1B6s0nNWWxByLMP2ZAyrfKyjcwMXLhRR7O3MK1Nt5wg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6171de5a-3049-425e-3157-08db97fe0489 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9563.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2023 10:55:45.8715 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Bi1+b2BPp3xRMkepDeODwPMhksQwGaA7Bt4DMtcDdpm020XTwMfEdMgdDQT62Ax06cor6j91jg9RRRUBe7hvhSTjOOIAveTKEgU8bOChxT0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8101 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Gaurav Jain error: Unchecked return value (CHECKED_RETURN) check_return: Calling sg_miter_next without checking return value fix: added check if(!sg_miter_next) Fixes: 8a2a0dd35f2e ("crypto: caam - strip input zeros from RSA input buffer") Signed-off-by: Gaurav Jain Signed-off-by: Meenakshi Aggarwal Reviewed-by: Gaurav Jain Reviewed-by: Gaurav Jain Reviewed-by: Gaurav Jain --- drivers/crypto/caam/caampkc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/caam/caampkc.c b/drivers/crypto/caam/caampkc.c index 72afc249d42f..7e08af751e4e 100644 --- a/drivers/crypto/caam/caampkc.c +++ b/drivers/crypto/caam/caampkc.c @@ -225,7 +225,9 @@ static int caam_rsa_count_leading_zeros(struct scatterlist *sgl, if (len && *buff) break; - sg_miter_next(&miter); + if (!sg_miter_next(&miter)) + break; + buff = miter.addr; len = miter.length;