crypto: lib/mpi: delete unnecessary condition
Subsystems (3)
PATCH 1/1 crypto: lib/mpi: delete unnecessary condition
We checked that "nlimbs" is non-zero in the outside if statement so delete the duplicate check here.
Signed-off-by Dan Carpenter <[email protected]>
--- lib/crypto/mpi/mpi-bit.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
lib/crypto/mpi/mpi-bit.c +4 -6
@@ -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);
Signature · 1 line
2.43.0
Hi,
Quoted 5 lines · Dan Carpenter
We checked that "nlimbs" is non-zero in the outside if statement so delete the duplicate check here.
Signed-off-by Dan Carpenter <[email protected]>---
Reviewed-by Tianjia Zhang <[email protected]>
Quoted 14 lines
lib/crypto/mpi/mpi-bit.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)lib/crypto/mpi/mpi-bit.c +0
-3@@ -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];
lib/crypto/mpi/mpi-bit.c void mpi_rshift(MPI x, MPI a, unsigned int n) · line 221
Quoted 10 lines
lib/crypto/mpi/mpi-bit.c +4
-3- 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
Herbert Xu
maintainerQuoted 7 lines · Dan Carpenter
We checked that "nlimbs" is non-zero in the outside if statement so delete the duplicate check here.
Signed-off-by Dan Carpenter <[email protected]>--- lib/crypto/mpi/mpi-bit.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt