From patchwork Tue Sep 12 09:42:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lionel Debieve X-Patchwork-Id: 9948857 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4F40C6038F for ; Tue, 12 Sep 2017 09:43:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3BA9A28E90 for ; Tue, 12 Sep 2017 09:43:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 300AC28E9D; Tue, 12 Sep 2017 09:43:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5E29828E90 for ; Tue, 12 Sep 2017 09:43:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version: Content-Type:In-Reply-To:References:Message-ID:Date:Subject:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=QWdkPmu9odLGUuidU+Q/akvk2kcZciRP4KfSMSJYRiE=; b=AH3POFpKUacvDsT6mAPIhKzWa IWFQkNvxnwylJJ0ld0rBS341vfTcPkTAHACs844e05a1AfMDmM7ERJ4Ng0s6IXxR5TU5QPmLJ+rML 1MhHaORI9KfHR286BMk737DPeKsxMqDumeVUyJQrNOxsOQTYxU+bIRvA/wEDXLWbUAe7MeCukWf0a CwL18dVuZpc1AyFVTZ61qF7UbPoBMFj/5lBSgrsdq/8OuB1NTXrW6WsK/3+BZRnV9Gyo3akllMWLn enjCnuNUkIwgb9B6oVK2+T7tGqjCrOisL/+9+6bQilcJp1CQqt4dnvgpjiIVxGWL7DOU5djk04GrY mid3e59eg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1drhid-0000mO-6S; Tue, 12 Sep 2017 09:42:59 +0000 Received: from mx08-00178001.pphosted.com ([91.207.212.93] helo=mx07-00178001.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1drhiX-0000fp-Bn for linux-arm-kernel@lists.infradead.org; Tue, 12 Sep 2017 09:42:57 +0000 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v8C9cfSi006242; Tue, 12 Sep 2017 11:42:06 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2cv76c0p6g-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 12 Sep 2017 11:42:06 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 4262C3F; Tue, 12 Sep 2017 09:42:04 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag3node2.st.com [10.75.127.8]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id F1B6F24E2; Tue, 12 Sep 2017 09:42:03 +0000 (GMT) Received: from SFHDAG7NODE2.st.com (10.75.127.20) by SFHDAG3NODE2.st.com (10.75.127.8) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Tue, 12 Sep 2017 11:42:03 +0200 Received: from SFHDAG7NODE2.st.com ([fe80::d548:6a8f:2ca4:2090]) by SFHDAG7NODE2.st.com ([fe80::d548:6a8f:2ca4:2090%20]) with mapi id 15.00.1178.000; Tue, 12 Sep 2017 11:42:03 +0200 From: Lionel DEBIEVE To: Arnd Bergmann Subject: Re: [PATCH 1/2] crypto: stm32 - Fix uninitialized data usage Thread-Topic: [PATCH 1/2] crypto: stm32 - Fix uninitialized data usage Thread-Index: AQHTK6tjohATjLf9pkGozF+FTK57LA== Date: Tue, 12 Sep 2017 09:42:03 +0000 Message-ID: References: <20170912093553.2580986-1-arnd@arndb.de> In-Reply-To: <20170912093553.2580986-1-arnd@arndb.de> Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: user-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.75.127.45] MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-09-12_04:, , signatures=0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170912_024253_721340_88D2331E X-CRM114-Status: GOOD ( 23.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre TORGUE , "linux-kernel@vger.kernel.org" , "linux-crypto@vger.kernel.org" , Maxime Coquelin , "David S. Miller" , "linux-arm-kernel@lists.infradead.org" , Herbert Xu Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Arnd, I've already push this fix for review last month, waiting the ack. BR, Lionel On 09/12/2017 11:35 AM, Arnd Bergmann wrote: > The error handling in stm32_hash_irq_thread passes > uninitialized data into stm32_hash_finish_req, as gcc > points out: > > drivers/crypto/stm32/stm32-hash.c: In function 'stm32_hash_irq_thread': > drivers/crypto/stm32/stm32-hash.c:1088:2: error: 'err' may be used uninitialized in this function [-Werror=maybe-uninitialized] > > I could not tell what data should be passed there instead, > so this changes the code to always pass zero, making it > well-defined, though possibly still wrong. Please check. > > Signed-off-by: Arnd Bergmann > --- > drivers/crypto/stm32/stm32-hash.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/crypto/stm32/stm32-hash.c b/drivers/crypto/stm32/stm32-hash.c > index b585ce54a802..3c23a23e9ee5 100644 > --- a/drivers/crypto/stm32/stm32-hash.c > +++ b/drivers/crypto/stm32/stm32-hash.c > @@ -1067,7 +1067,6 @@ static int stm32_hash_cra_sha256_init(struct crypto_tfm *tfm) > static irqreturn_t stm32_hash_irq_thread(int irq, void *dev_id) > { > struct stm32_hash_dev *hdev = dev_id; > - int err; > > if (HASH_FLAGS_CPU & hdev->flags) { > if (HASH_FLAGS_OUTPUT_READY & hdev->flags) { > @@ -1085,7 +1084,7 @@ static irqreturn_t stm32_hash_irq_thread(int irq, void *dev_id) > > finish: > /*Finish current request */ > - stm32_hash_finish_req(hdev->req, err); > + stm32_hash_finish_req(hdev->req, 0); > > return IRQ_HANDLED; > } Remove err symbol as this is not used in the thread context and the variable is not initialized. Signed-off-by: Lionel Debieve --- drivers/crypto/stm32/stm32-hash.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/stm32/stm32-hash.c b/drivers/crypto/stm32/stm32-hash.c index b585ce5..b34ee85 100644 --- a/drivers/crypto/stm32/stm32-hash.c +++ b/drivers/crypto/stm32/stm32-hash.c @@ -1067,7 +1067,6 @@ static int stm32_hash_cra_sha256_init(struct crypto_tfm *tfm) static irqreturn_t stm32_hash_irq_thread(int irq, void *dev_id) { struct stm32_hash_dev *hdev = dev_id; - int err; if (HASH_FLAGS_CPU & hdev->flags) { if (HASH_FLAGS_OUTPUT_READY & hdev->flags) { @@ -1084,8 +1083,8 @@ static irqreturn_t stm32_hash_irq_thread(int irq, void *dev_id) return IRQ_HANDLED; finish: - /*Finish current request */ - stm32_hash_finish_req(hdev->req, err); + /* Finish current request */ + stm32_hash_finish_req(hdev->req, 0); return IRQ_HANDLED; }