From patchwork Fri Sep 25 08:19:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herbert Xu X-Patchwork-Id: 11799325 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7CE1E112C for ; Fri, 25 Sep 2020 08:22:19 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3F4472085B for ; Fri, 25 Sep 2020 08:22:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tQgs/Hqe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F4472085B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gondor.apana.org.au Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vJLZ3oA+JwdojyY8bblGsYBdq3c8ERTcUi+MvDEnmnI=; b=tQgs/Hqe+mIAd+Pfv2pqnxABe hbfjUg6y86lvNjSJcUfcjAMQ5cJUU3IcgemyNjDJ349/pCMUHN2ZiK6ZcQleRXT7buYRvEe+WHyGL FEpbNDpoduojhy/oF7Qd3DOkMZHTbC6UcTyO4c5BR8jdiEDSr8/6Uh7cx3o+ZjsbJ0nGI1vMqZ9JO xXQtl1isSPcBaG2r1hWExeNlzkQ8RElKI2CRwfQxo3KMSxlBcl5oHAh0rjKINbTvE7lewnlzSlXXW 4h9RMbnK/R2QuEsNDVnBATSz8AQxrrBn3ILd1I8z6niSYwyaVDMla8tdHsXkJRGqeaNBBRpL0BwyP hAxEtS1ew==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLiyF-00025U-EJ; Fri, 25 Sep 2020 08:20:47 +0000 Received: from helcar.hmeau.com ([216.24.177.18] helo=fornost.hmeau.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLiyC-00024e-Km for linux-arm-kernel@lists.infradead.org; Fri, 25 Sep 2020 08:20:45 +0000 Received: from gwarestrin.arnor.me.apana.org.au ([192.168.0.7]) by fornost.hmeau.com with smtp (Exim 4.92 #5 (Debian)) id 1kLixP-0007SY-SN; Fri, 25 Sep 2020 18:19:57 +1000 Received: by gwarestrin.arnor.me.apana.org.au (sSMTP sendmail emulation); Fri, 25 Sep 2020 18:19:55 +1000 Date: Fri, 25 Sep 2020 18:19:55 +1000 From: Herbert Xu To: Tianjia Zhang Subject: [PATCH] lib/mpi: Fix unused variable warnings Message-ID: <20200925081955.GV6381@gondor.apana.org.au> References: <20200920162103.83197-1-tianjia.zhang@linux.alibaba.com> <20200920162103.83197-3-tianjia.zhang@linux.alibaba.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200920162103.83197-3-tianjia.zhang@linux.alibaba.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200925_042044_682328_3A18243D X-CRM114-Status: GOOD ( 15.23 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Biggers , Stephan Mueller , Brendan Higgins , Jia Zhang , Jarkko Sakkinen , Vitaly Chikunov , keyrings@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Masahiro Yamada , James Morris , Lakshmi Ramasubramanian , Marcelo Henrique Cerri , Waiman Long , "Serge E. Hallyn" , Alexandre Torgue , "Steven Rostedt \(VMware\)" , Gilad Ben-Yossef , Mimi Zohar , Tushar Sugandhi , linux-integrity@vger.kernel.org, linux-arm-kernel@lists.infradead.org, David Howells , Pascal van Leeuwen , linux-kernel@vger.kernel.org, Xufeng Zhang , linux-security-module@vger.kernel.org, linux-crypto@vger.kernel.org, Maxime Coquelin , Johannes Weiner , Colin Ian King , Andrew Morton , "David S. Miller" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On Mon, Sep 21, 2020 at 12:20:55AM +0800, Tianjia Zhang wrote: > Expand the mpi library based on libgcrypt, and the ECC algorithm of > mpi based on libgcrypt requires these functions. > Some other algorithms will be developed based on mpi ecc, such as SM2. > > Signed-off-by: Tianjia Zhang > Tested-by: Xufeng Zhang This creates some compiler warnings. ---8<--- This patch removes a number of unused variables and marks others as unused in order to silence compiler warnings about them. Fixes: a8ea8bdd9df9 ("lib/mpi: Extend the MPI library") Signed-off-by: Herbert Xu Tested-by: Tianjia Zhang diff --git a/lib/mpi/mpi-div.c b/lib/mpi/mpi-div.c index 21332dab97d4..45beab8b9e9e 100644 --- a/lib/mpi/mpi-div.c +++ b/lib/mpi/mpi-div.c @@ -92,7 +92,6 @@ void mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den) unsigned int normalization_steps; mpi_limb_t q_limb; mpi_ptr_t marker[5]; - unsigned int marker_nlimbs[5]; int markidx = 0; /* Ensure space is enough for quotient and remainder. @@ -152,7 +151,6 @@ void mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den) * numerator would be gradually overwritten by the quotient limbs. */ if (qp == np) { /* Copy NP object to temporary space. */ - marker_nlimbs[markidx] = nsize; np = marker[markidx++] = mpi_alloc_limb_space(nsize); MPN_COPY(np, qp, nsize); } @@ -173,7 +171,6 @@ void mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den) * the most significant word. Use temporary storage not to clobber * the original contents of the denominator. */ - marker_nlimbs[markidx] = dsize; tp = marker[markidx++] = mpi_alloc_limb_space(dsize); mpihelp_lshift(tp, dp, dsize, normalization_steps); dp = tp; @@ -195,7 +192,6 @@ void mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den) if (dp == rp || (quot && (dp == qp))) { mpi_ptr_t tp; - marker_nlimbs[markidx] = dsize; tp = marker[markidx++] = mpi_alloc_limb_space(dsize); MPN_COPY(tp, dp, dsize); dp = tp; diff --git a/lib/mpi/mpi-internal.h b/lib/mpi/mpi-internal.h index d29c4537c3a3..554002182db1 100644 --- a/lib/mpi/mpi-internal.h +++ b/lib/mpi/mpi-internal.h @@ -114,7 +114,7 @@ typedef int mpi_size_t; /* (must be a signed type) */ */ #define UDIV_QRNND_PREINV(q, r, nh, nl, d, di) \ do { \ - mpi_limb_t _ql; \ + mpi_limb_t _ql __maybe_unused; \ mpi_limb_t _q, _r; \ mpi_limb_t _xh, _xl; \ umul_ppmm(_q, _ql, (nh), (di)); \ diff --git a/lib/mpi/mpi-mul.c b/lib/mpi/mpi-mul.c index 587e6335cc12..8f5fa200f297 100644 --- a/lib/mpi/mpi-mul.c +++ b/lib/mpi/mpi-mul.c @@ -21,7 +21,6 @@ void mpi_mul(MPI w, MPI u, MPI v) int usign, vsign, sign_product; int assign_wp = 0; mpi_ptr_t tmp_limb = NULL; - unsigned int tmp_limb_nlimbs = 0; if (u->nlimbs < v->nlimbs) { /* Swap U and V. */ @@ -55,7 +54,6 @@ void mpi_mul(MPI w, MPI u, MPI v) } else { /* Make U and V not overlap with W. */ if (wp == up) { /* W and U are identical. Allocate temporary space for U. */ - tmp_limb_nlimbs = usize; up = tmp_limb = mpi_alloc_limb_space(usize); /* Is V identical too? Keep it identical with U. */ if (wp == vp) @@ -64,7 +62,6 @@ void mpi_mul(MPI w, MPI u, MPI v) MPN_COPY(up, wp, usize); } else if (wp == vp) { /* W and V are identical. Allocate temporary space for V. */ - tmp_limb_nlimbs = vsize; vp = tmp_limb = mpi_alloc_limb_space(vsize); /* Copy to the temporary space. */ MPN_COPY(vp, wp, vsize); diff --git a/lib/mpi/mpih-div.c b/lib/mpi/mpih-div.c index 182a656a1ba0..be70ee2e42d3 100644 --- a/lib/mpi/mpih-div.c +++ b/lib/mpi/mpih-div.c @@ -31,7 +31,7 @@ mpihelp_mod_1(mpi_ptr_t dividend_ptr, mpi_size_t dividend_size, { mpi_size_t i; mpi_limb_t n1, n0, r; - mpi_limb_t dummy; + mpi_limb_t dummy __maybe_unused; /* Botch: Should this be handled at all? Rely on callers? */ if (!dividend_size) @@ -382,7 +382,7 @@ mpihelp_divmod_1(mpi_ptr_t quot_ptr, { mpi_size_t i; mpi_limb_t n1, n0, r; - mpi_limb_t dummy; + mpi_limb_t dummy __maybe_unused; if (!dividend_size) return 0;