Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1129314pxk; Fri, 25 Sep 2020 07:02:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJLaP21+f6XP8ZTJoAJ4Zq+pjLVrvlRgsQm/jvZmNC26/acPb06ppnTVle9qMQW8on/Bcg X-Received: by 2002:a17:906:bcfc:: with SMTP id op28mr2949599ejb.248.1601042575824; Fri, 25 Sep 2020 07:02:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601042575; cv=none; d=google.com; s=arc-20160816; b=r3AhWxnwvfEa24lXdoT4sHwg9h9HtKj/eK6pcIrCD3sbhoWBb7qeZydk6YAOQm+vK0 RmX3AUksxe9N6CbjsuNWtgRMKSeVhTuj8XtjA7wZthS70oiH9w9uGDR45v7EkHRtHgK1 NXChLn+ifnx/85V38fsM9EL5W4+KI8cyMOqgr2gVodJvaX/zruYm4VieTlbizgZLQnUn 2zvuPcpLjvbSSOMoO7NQpZVSF+aVWnCrfWvFUzLydg34zoDy6VuAU9+s4qIaSvOSaVvw ChRErRgWgiNOV8RVvf2OdHiX3e+K8giZLnQzZIMb1PP0LpAXSVjA2+PwOpjwRPpfHQ9+ KiPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=7GuP8EVhn5S4Q91I8OQqdiEDX4e3UiJHYvJr6Y5TowI=; b=CtMXFG/hk9vanrArDxr2XUnOOQj+oYnWCdpiUOtRcDDOyuRQl3+5wxBfx2RrMn4RhV rgIOo7OT8n2ytqQozen8ry7183bknhzOWAch+x1Uxp1HckROgmxQFyjjP1Ns2Sq5fokU BqKEre22kvrDLklqTVv+PDdUawxEpTfBbBoCraktBMIaH7ubCb2PMJKIfu5i+7k5d83I SKeS4l6UFLQQMLWtH6vbdF+pvatkytq+H1LP6aumvQPIEWi35GrkXIHpH0UMT1hrccCG bkLqRtjx8Iyt4Z3KmPIkNYnktHuYvSM9KhKM/Oa9ws9VwpluHUuFzubfmKQdy2bhnWH9 cN4Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r26si1877300eds.384.2020.09.25.07.02.29; Fri, 25 Sep 2020 07:02:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728802AbgIYOBZ (ORCPT + 99 others); Fri, 25 Sep 2020 10:01:25 -0400 Received: from out30-42.freemail.mail.aliyun.com ([115.124.30.42]:39918 "EHLO out30-42.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728365AbgIYOBZ (ORCPT ); Fri, 25 Sep 2020 10:01:25 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R601e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04357;MF=tianjia.zhang@linux.alibaba.com;NM=1;PH=DS;RN=33;SR=0;TI=SMTPD_---0UA2lM0k_1601042472; Received: from 30.25.232.10(mailfrom:tianjia.zhang@linux.alibaba.com fp:SMTPD_---0UA2lM0k_1601042472) by smtp.aliyun-inc.com(127.0.0.1); Fri, 25 Sep 2020 22:01:14 +0800 Subject: Re: [PATCH] lib/mpi: Fix unused variable warnings To: Herbert Xu Cc: "David S. Miller" , David Howells , Eric Biggers , Jarkko Sakkinen , Maxime Coquelin , Alexandre Torgue , James Morris , "Serge E. Hallyn" , Stephan Mueller , Marcelo Henrique Cerri , "Steven Rostedt (VMware)" , Masahiro Yamada , Brendan Higgins , Andrew Morton , Johannes Weiner , Waiman Long , Mimi Zohar , Lakshmi Ramasubramanian , Colin Ian King , Tushar Sugandhi , Vitaly Chikunov , Gilad Ben-Yossef , Pascal van Leeuwen , linux-crypto@vger.kernel.org, keyrings@vger.kernel.org, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Xufeng Zhang , Jia Zhang References: <20200920162103.83197-1-tianjia.zhang@linux.alibaba.com> <20200920162103.83197-3-tianjia.zhang@linux.alibaba.com> <20200925081955.GV6381@gondor.apana.org.au> From: Tianjia Zhang Message-ID: <5dc5b1cf-389c-0f96-0b8c-50fa41d186a9@linux.alibaba.com> Date: Fri, 25 Sep 2020 22:01:12 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.2.2 MIME-Version: 1.0 In-Reply-To: <20200925081955.GV6381@gondor.apana.org.au> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Herbert, Thanks for your patch, The changes look good. I have tested this patch, so, Tested-by: Tianjia Zhang Best regards, Tianjia On 9/25/20 4:19 PM, Herbert Xu wrote: > 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 > > 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; >