public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "tianjia.zhang" <tianjia.zhang@linux.alibaba.com>
To: Dan Carpenter <dan.carpenter@linaro.org>,
	Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>,
	Mimi Zohar <zohar@linux.ibm.com>,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] crypto: lib/mpi: delete unnecessary condition
Date: Fri, 5 Jul 2024 14:43:11 +0800	[thread overview]
Message-ID: <e5e4db6f-079c-45e7-b079-ef2a6851dd29@linux.alibaba.com> (raw)
In-Reply-To: <6686bed3.4a0a0220.6aa45.6c34@mx.google.com>

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@linaro.org>
> ---


Reviewed-by: Tianjia Zhang <tianjia.zhang@linux.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


  reply	other threads:[~2024-07-05  6:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-04 15:25 [PATCH] crypto: lib/mpi: delete unnecessary condition Dan Carpenter
2024-07-05  6:43 ` tianjia.zhang [this message]
2024-07-12 23:57 ` 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=e5e4db6f-079c-45e7-b079-ef2a6851dd29@linux.alibaba.com \
    --to=tianjia.zhang@linux.alibaba.com \
    --cc=dan.carpenter@linaro.org \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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