Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp30123136rwd; Thu, 6 Jul 2023 00:57:05 -0700 (PDT) X-Google-Smtp-Source: APBJJlG0BxOxHbBi2rLcmDqyytdy/zIYszLF5LYokcElrCAF9yhaaHfbBcSWB+sd6KZNodbbuvLK X-Received: by 2002:a05:6e02:1292:b0:341:c98a:529 with SMTP id y18-20020a056e02129200b00341c98a0529mr1723308ilq.0.1688630225455; Thu, 06 Jul 2023 00:57:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688630225; cv=none; d=google.com; s=arc-20160816; b=XhD/Br7ZEu7nAUK/Jwm3cR+Ju1NkypGyyx0Gt9FPOA6N8Bg0RjNALSaMIlpSn9Yx1u GzQnbwz5pu6q6ls60GiEUzFlu499lIcWLsQof09VBNlVRRHPEHMdNKT5pK6LakrFoc7x O6tBIkrAx+k9glywihHPfMkdvq5/Ha0JRoeZ4PWiOrakOfHIbN6dmEvEz72HDP0PB0Ij kH8C0fH5AuePc+JD8IyVn5FTeD+fE9/eDKmQqMHTZJb1pwWcf3rGeg5Ff5B93gXq518+ w4Lqg6PFHIaMscHF2oCXdml4sln6nK2pQpuj53Ov+nLaT5SqO9G+3aoL6uLXkbv8PmFO IsdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PfAHj2kIu4BiEupqCN/x5eDmT54OuWz7NkSCvOR65s0=; fh=tUOLXbYg6yQ+/v4k7Q2EmKHjiTMAnnvqlYEqREZQ370=; b=GdtU2J3UNDmOnTjl5Vz0yl3jPQZcVETE9p+qDIGz2B7o2qD4bvCmHy9vZF6bnOXtCH yuGOdy5PblALLctCS57Dn1d1cynkwi2LdhCh1vPJOrb1HR/h3bpn0pHEeUCMZiKf+oRg RrZXMoEu0uKCBm5mguJWDjg8tM70n9vg+oMK0vqpoxwTNHfVQIyRUN3cA/b49IM3xxiP JY1y+Lz2Cxu26r40rxVDN2VwsUi3JZybcF09608MBd0AehrL6YMAK3zZsnvAier1v8qd HZUm9MevU4sHgU1ZOeJ1E/Fg/n9fNavsngJA7SadGBboL9qhJvstF+OFefspO49h/L/t PEiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=cUa8CO82; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y1-20020a63ce01000000b0054fd3dd12d4si917997pgf.799.2023.07.06.00.56.51; Thu, 06 Jul 2023 00:57:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=cUa8CO82; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233897AbjGFHis (ORCPT + 99 others); Thu, 6 Jul 2023 03:38:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233861AbjGFHid (ORCPT ); Thu, 6 Jul 2023 03:38:33 -0400 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 849AE1982; Thu, 6 Jul 2023 00:38:28 -0700 (PDT) Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3666jUk3007748; Thu, 6 Jul 2023 09:38:03 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=selector1; bh=PfAHj2kIu4BiEupqCN/x5eDmT54OuWz7NkSCvOR65s0=; b=cUa8CO82xveDwRfrgIcghMUQGphSbAY8a1KoIpy6PTAXVxP21NbBo+FOAddyxIdQpbDj zlhPBbyTHRR73RBnll4IuDjKpo8K/csH0IC0xfePWEQ475pwgvZRQ2axmY1/kiL4rjlf A86aJ4NH3B1OiITnXX0qsRA9RfgXb5ubrUQLt2lrSV9rs5olv5yvAY+3LtXPmis9lwdV MZ2AmkDik5bOjSJ2p3FJyvNuwFrsODas6AbpVHoSdMDG/lIrImiAut7cIhv17HuSx68b pXNbIBKbZ5OqRpha8c3ijv+X46P093sfjYtJZ4jlMrwDylFNUQUENXYHxnW6n7TV8+Uc 7A== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3rna75ncqa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 06 Jul 2023 09:38:03 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 01D8410005B; Thu, 6 Jul 2023 09:38:03 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id EE707211F33; Thu, 6 Jul 2023 09:38:02 +0200 (CEST) Received: from localhost (10.201.22.9) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 6 Jul 2023 09:38:02 +0200 From: Thomas BOURGOIN To: Thomas BOURGOIN , Herbert Xu , "David S . Miller" , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue , Lionel Debieve , Linus Walleij CC: , , , , Subject: [PATCH 4/7] crypto: stm32 - fix loop iterating through scatterlist for DMA Date: Thu, 6 Jul 2023 09:37:16 +0200 Message-ID: <20230706073719.1156288-5-thomas.bourgoin@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230706073719.1156288-1-thomas.bourgoin@foss.st.com> References: <20230706073719.1156288-1-thomas.bourgoin@foss.st.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.201.22.9] X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-06_04,2023-07-06_01,2023-05-22_02 X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Thomas Bourgoin We were reading the length of the scatterlist sg after copying value of tsg inside. So we are using the size of the previous scatterlist and for the first one we are using an unitialised value. Fix this by copying tsg in sg[0] before reading the size. Signed-off-by: Thomas Bourgoin --- drivers/crypto/stm32/stm32-hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/stm32/stm32-hash.c b/drivers/crypto/stm32/stm32-hash.c index 420df501360d..bc2651ef5208 100644 --- a/drivers/crypto/stm32/stm32-hash.c +++ b/drivers/crypto/stm32/stm32-hash.c @@ -678,9 +678,9 @@ static int stm32_hash_dma_send(struct stm32_hash_dev *hdev) } for_each_sg(rctx->sg, tsg, rctx->nents, i) { + sg[0] = *tsg; len = sg->length; - sg[0] = *tsg; if (sg_is_last(sg)) { if (hdev->dma_mode == 1) { len = (ALIGN(sg->length, 16) - 16); -- 2.25.1