From: Herbert Xu <herbert@gondor.apana.org.au>
To: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Cc: "David S. Miller" <davem@davemloft.net>,
David Howells <dhowells@redhat.com>,
Eric Biggers <ebiggers@google.com>,
Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@st.com>,
James Morris <jmorris@namei.org>,
"Serge E. Hallyn" <serge@hallyn.com>,
Stephan Mueller <smueller@chronox.de>,
Marcelo Henrique Cerri <marcelo.cerri@canonical.com>,
"Steven Rostedt (VMware)" <rostedt@goodmis.org>,
Masahiro Yamada <masahiroy@kernel.org>,
Brendan Higgins <brendanhiggins@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Waiman Long <longman@redhat.com>,
Mimi Zohar <zohar@linux.ibm.com>,
Lakshmi Ramasubramanian <nramas@linux.microsoft.com>,
Colin Ian King <colin.king@canonical.com>,
Tushar Sugandhi <tusharsu@linux.microsoft.com>,
Vitaly Chikunov <vt@altlinux.org>,
Gilad Ben-Yossef <gilad@benyossef.com>,
Pascal van Leeuwen <pvanleeuwen@rambus.com>,
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 <yunbo.xufeng@linux.alibaba.com>,
Jia Zhang <zhang.jia@linux.alibaba.com>
Subject: [PATCH] lib/mpi: Fix unused variable warnings
Date: Fri, 25 Sep 2020 18:19:55 +1000 [thread overview]
Message-ID: <20200925081955.GV6381@gondor.apana.org.au> (raw)
In-Reply-To: <20200920162103.83197-3-tianjia.zhang@linux.alibaba.com>
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 <tianjia.zhang@linux.alibaba.com>
> Tested-by: Xufeng Zhang <yunbo.xufeng@linux.alibaba.com>
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 <herbert@gondor.apana.org.au>
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;
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
next prev parent reply other threads:[~2020-09-25 8:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-20 16:20 [PATCH v7 00/10] crpyto: introduce OSCCA certificate and SM2 asymmetric algorithm Tianjia Zhang
2020-09-20 16:20 ` [PATCH v7 01/10] crypto: sm3 - export crypto_sm3_final function Tianjia Zhang
2020-09-20 16:20 ` [PATCH v7 02/10] lib/mpi: Extend the MPI library Tianjia Zhang
2020-09-25 8:19 ` Herbert Xu [this message]
2020-09-25 9:59 ` [PATCH] lib/mpi: Fix unused variable warnings Tianjia Zhang
2020-09-25 14:01 ` Tianjia Zhang
2020-09-20 16:20 ` [PATCH v7 03/10] lib/mpi: Introduce ec implementation to MPI library Tianjia Zhang
2020-09-20 16:20 ` [PATCH v7 04/10] crypto: sm2 - introduce OSCCA SM2 asymmetric cipher algorithm Tianjia Zhang
2020-09-20 16:20 ` [PATCH v7 05/10] crypto: testmgr - support test with different ciphertext per encryption Tianjia Zhang
2020-09-20 16:20 ` [PATCH v7 06/10] crypto: testmgr - Fix potential memory leak in test_akcipher_one() Tianjia Zhang
2020-09-20 16:21 ` [PATCH v7 07/10] crypto: sm2 - add SM2 test vectors to testmgr Tianjia Zhang
2020-09-20 16:21 ` [PATCH v7 08/10] X.509: support OSCCA certificate parse Tianjia Zhang
2020-09-20 16:21 ` [PATCH v7 09/10] X.509: support OSCCA SM2-with-SM3 certificate verification Tianjia Zhang
2020-09-20 16:21 ` [PATCH v7 10/10] integrity: Asymmetric digsig supports SM2-with-SM3 algorithm Tianjia Zhang
2020-09-25 8:17 ` [PATCH v7 00/10] crpyto: introduce OSCCA certificate and SM2 asymmetric algorithm Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200925081955.GV6381@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=akpm@linux-foundation.org \
--cc=alexandre.torgue@st.com \
--cc=brendanhiggins@google.com \
--cc=colin.king@canonical.com \
--cc=davem@davemloft.net \
--cc=dhowells@redhat.com \
--cc=ebiggers@google.com \
--cc=gilad@benyossef.com \
--cc=hannes@cmpxchg.org \
--cc=jarkko.sakkinen@linux.intel.com \
--cc=jmorris@namei.org \
--cc=keyrings@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=longman@redhat.com \
--cc=marcelo.cerri@canonical.com \
--cc=masahiroy@kernel.org \
--cc=mcoquelin.stm32@gmail.com \
--cc=nramas@linux.microsoft.com \
--cc=pvanleeuwen@rambus.com \
--cc=rostedt@goodmis.org \
--cc=serge@hallyn.com \
--cc=smueller@chronox.de \
--cc=tianjia.zhang@linux.alibaba.com \
--cc=tusharsu@linux.microsoft.com \
--cc=vt@altlinux.org \
--cc=yunbo.xufeng@linux.alibaba.com \
--cc=zhang.jia@linux.alibaba.com \
--cc=zohar@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).