[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e5e4db6f-079c-45e7-b079-ef2a6851dd29@linux.alibaba.com>
Date: Fri, 5 Jul 2024 14:43:11 +0800
From: "tianjia.zhang" <tianjia.zhang@...ux.alibaba.com>
To: Dan Carpenter <dan.carpenter@...aro.org>,
Herbert Xu <herbert@...dor.apana.org.au>
Cc: "David S. Miller" <davem@...emloft.net>, Mimi Zohar
<zohar@...ux.ibm.com>, linux-crypto@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] crypto: lib/mpi: delete unnecessary condition
Hi,
On 2024/7/4 23:25, Dan Carpenter wrote:
> We checked that "nlimbs" is non-zero in the outside if statement so delete
> the duplicate check here.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
> ---
Reviewed-by: Tianjia Zhang <tianjia.zhang@...ux.alibaba.com>
> lib/crypto/mpi/mpi-bit.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/lib/crypto/mpi/mpi-bit.c b/lib/crypto/mpi/mpi-bit.c
> index 070ba784c9f1..e08fc202ea5c 100644
> --- a/lib/crypto/mpi/mpi-bit.c
> +++ b/lib/crypto/mpi/mpi-bit.c
> @@ -212,12 +212,10 @@ void mpi_rshift(MPI x, MPI a, unsigned int n)
> return;
> }
>
> - if (nlimbs) {
> - for (i = 0; i < x->nlimbs - nlimbs; i++)
> - x->d[i] = x->d[i+nlimbs];
> - x->d[i] = 0;
> - x->nlimbs -= nlimbs;
> - }
> + for (i = 0; i < x->nlimbs - nlimbs; i++)
> + x->d[i] = x->d[i+nlimbs];
> + x->d[i] = 0;
> + x->nlimbs -= nlimbs;
>
> if (x->nlimbs && nbits)
> mpihelp_rshift(x->d, x->d, x->nlimbs, nbits);
Cheers,
Tianjia
Powered by blists - more mailing lists