From patchwork Thu Jul 13 15:15:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Bourgoin X-Patchwork-Id: 119999 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1922196vqm; Thu, 13 Jul 2023 09:01:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlGFB7p5Rlud3WAW7/v4KmeQHMQ6JrivhqZmmzFJhplDntHttN5s5dtF66VEytRcjLZHWTwL X-Received: by 2002:a05:6a20:6a0d:b0:131:47f7:e811 with SMTP id p13-20020a056a206a0d00b0013147f7e811mr2201174pzk.22.1689264112813; Thu, 13 Jul 2023 09:01:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689264112; cv=none; d=google.com; s=arc-20160816; b=TnZl3VtJONyhM2rOjIKse6A7WKzMh03fBBxF3yisMgNQlFPqmODzrHEkK8czb0H/+6 Dfx8Qjn3KHBcQQHrYSS8EjF15Y1guAQVV4N1rP7XyT0ZdbPBVPMp/Atqd+Q5YAt0p9sn BDKyykLVV0+IPT+gBK1KBUWNG72Ql9RgOkVzKblmeSHeD9yn3ukh95e0LCY1ryhFEtR6 MDTKnxqi6pmRVsVOeowggdV3GPyZZYskb2b75hj0CeTBHkimId8WhIMJgDqcdp8VX1k/ cUxtY+foQBa7g42+Nm44qYf7860wkC200AfwMIDljMSdrOgeNeISzolDopMikwd8dWQ0 F0vw== 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=xQ3+qKLVZVZ6Z94h+CiU4oGATjbciwdLoWhA1jjC0AE=; fh=h4nnPKYwneAM8ktZXW2IGzF/vXr31bIFHUsmxzT7KKA=; b=KfGQefFsfiuVyeLND8tBW7HUOPqFiwI1eSZHpW/TFpnaJ34t6MfuKbOxsjYkqXLnp0 441SZLJ1gjNsER+XHIvJ4hB4Vkg6+whgOb7R3DBJFCgqVaRabWj6ZMNDCrtxVdnPwSeu iOorJaN4oTA3SthaDXe+Zv/On+e0RSUKlCKuoPm6pDCia47ZwOhUWJD3AwCLrkkK18QC RdciW9/NeIkKuUd9bYXawM0shi4abq/5gupzuJCwuxSkCKbcHdcBHLG7VPWFmdReDHLh 64vxtFmYdkRvYtvq9rZKiAat4LQT22eNmNZ5CgdMlgWwgob0as5k3KxW/4oxD9HQeiuB 4Ecw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=wqu2xlBX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a16-20020a056a001d1000b0067b51fca490si5221405pfx.248.2023.07.13.09.01.37; Thu, 13 Jul 2023 09:01:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=wqu2xlBX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S233471AbjGMPRU (ORCPT + 99 others); Thu, 13 Jul 2023 11:17:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233642AbjGMPRG (ORCPT ); Thu, 13 Jul 2023 11:17:06 -0400 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CADDB1FD8; Thu, 13 Jul 2023 08:16:52 -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 36DDI9Mm009977; Thu, 13 Jul 2023 17:16:38 +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=xQ3+qKLVZVZ6Z94h+CiU4oGATjbciwdLoWhA1jjC0AE=; b=wqu2xlBX4hJdeIG0emMqqguu/DYQWFQ39XZvajVgi0cIabCRDxUuRZywh063VRL9Ph8T 8/qb7g/BiLjO2Ua7O3e2CI3HhKslRNvLSgsjb2GqRZ8zLwTBYOIum8JycdkTDjvesbio 8PbNzMdHiOv3e6DbaFs+wdV7mrN1XA/kQLkMIt1gBieVajLTFEybKc1AINSgvx55enM3 l1GU8qqmG+7mHA61dJjkGJHKulkBPc564xWpcxzoBrMKqJHp5B+CUtacSArNJd4XGDm8 1Zp6DYo6PxrrRw3Gty7ks6wT1Fa4VdWjt+WnbAqQ5CKquoBZdlUskx0fradEVq8qkJyK /Q== 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 3rtedtjfp6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jul 2023 17:16:38 +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 53A48100056; Thu, 13 Jul 2023 17:16:38 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 4B52F22A6D9; Thu, 13 Jul 2023 17:16:38 +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, 13 Jul 2023 17:16:40 +0200 From: Thomas BOURGOIN To: Herbert Xu , "David S . Miller" , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue , Lionel Debieve , Linus Walleij CC: , , , , , Thomas Bourgoin , Subject: [PATCH v2 4/7] crypto: stm32 - fix loop iterating through scatterlist for DMA Date: Thu, 13 Jul 2023 17:15:15 +0200 Message-ID: <20230713151518.1513949-5-thomas.bourgoin@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230713151518.1513949-1-thomas.bourgoin@foss.st.com> References: <20230713151518.1513949-1-thomas.bourgoin@foss.st.com> MIME-Version: 1.0 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-13_05,2023-07-13_01,2023-05-22_02 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_BLOCKED,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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771321806285090010 X-GMAIL-MSGID: 1771321806285090010 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. Fixes : 8a1012d3f2ab ("crypto: stm32 - Support for STM32 HASH module") Cc: stable@vger.kernel.org Signed-off-by: Thomas Bourgoin --- Changes in v2: - Add Fixes 8a1012d3f2ab ("crypto: stm32 - Support for STM32 HASH module") - Add Cc: stable@vger.kernel.org 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 c179a6c1a457..519fb716acee 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);