From patchwork Thu Jul 6 07:37:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Bourgoin X-Patchwork-Id: 116547 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp2383443vqx; Thu, 6 Jul 2023 00:49:12 -0700 (PDT) X-Google-Smtp-Source: APBJJlEl13oxJuFplicrdWzTmk2FzLmYOIYEU0ERDHh8n9+6u54rbvmLdh5F9A+C0eJEtpkiMXzT X-Received: by 2002:a17:90a:4e0f:b0:262:d1b8:5d43 with SMTP id n15-20020a17090a4e0f00b00262d1b85d43mr1961870pjh.22.1688629752053; Thu, 06 Jul 2023 00:49:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688629752; cv=none; d=google.com; s=arc-20160816; b=tpG2dIwXrOKoFFQihNHepMhQQyP/3oOx/tNcSzjqgxkbdrcusnLMguXgOgPDea/nHv 4CHX+pA2aVp3C1GmRsp3J6Wt9bUzo0JlRki/yxLVt46kEs1JZby0YU9d6AAVM8IfvjEq H4qujNMT9Z2d8M+M7gjdrnVaFE2AIBUeMhKl3vAaoWWKhEzR3u0nVXAp4gpjbb3mdwpF aq3YwOEk64kgQZ7KIpsN+6ti6x2h1WJWRX6AVvS49fA899fJYX+xthSfuoY/QGBh46yd I5k1fTSJFgWqSKdONaJIBDAPzjpAOCVL5TlV7bhhpIYHn6JyA94Jjvsz682js8uPM/k0 9keg== 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=038wUR5S8oEVh6lA6g7sg+cYx1p/Mt2FmLJUNhZRD7JeO8qMjHhzoo+8b80Nts3rd2 coSNzJGZbu7WXA5yClQ1MCTPBqmQ8tU9s7Qok5M0RlaIHar9k/Ke4XpO3SSrY+STH2of j3C+qTbwf1cICQVkOqaxISCk6JXgLol8Tf2XhxTfMrBEZ5ZBcqKOLtWDBTQAjHZEu2ua IrDRIho4wiVQ3aXawGg/7Ng8le9nK+KzLq1TXEkXJZCrYFRnb9FnVeOPdbj8QYU8q24d Q8LfixUcc8mX/5KZMgzsSveQO7pX3gRHnOQV2nWTgCLjjv1m2mRV7UknKkEOci7v2JaI 2Ukw== 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-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 m10-20020a17090a7f8a00b002563db5c4b0si3198655pjl.184.2023.07.06.00.48.58; Thu, 06 Jul 2023 00:49:12 -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=cUa8CO82; 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 S233879AbjGFHiu (ORCPT + 99 others); Thu, 6 Jul 2023 03:38:50 -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 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770656630838251799?= X-GMAIL-MSGID: =?utf-8?q?1770656630838251799?= 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);