diff options
author | Nicolai Stange <nicstange@gmail.com> | 2016-03-22 13:12:36 +0100 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2016-04-05 14:35:46 +0200 |
commit | 654842ef53d7820129a751f5cc620e5a69c694a9 (patch) | |
tree | 46a1c898fcaa82c8604e34ec2b4d3f396a6d369d /lib | |
parent | lib/mpi: mpi_write_sgl(): fix skipping of leading zero limbs (diff) | |
download | linux-654842ef53d7820129a751f5cc620e5a69c694a9.tar.xz linux-654842ef53d7820129a751f5cc620e5a69c694a9.zip |
lib/mpi: mpi_write_sgl(): fix style issue with lzero decrement
Within the copying loop in mpi_write_sgl(), we have
if (lzeros > 0) {
...
lzeros -= sizeof(alimb);
}
However, at this point, lzeros < sizeof(alimb) holds. Make this fact
explicit by rewriting the above to
if (lzeros) {
...
lzeros = 0;
}
Signed-off-by: Nicolai Stange <nicstange@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mpi/mpicoder.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/mpi/mpicoder.c b/lib/mpi/mpicoder.c index 6bb52beb06b0..d8b372b9cc11 100644 --- a/lib/mpi/mpicoder.c +++ b/lib/mpi/mpicoder.c @@ -402,14 +402,14 @@ int mpi_write_to_sgl(MPI a, struct scatterlist *sgl, unsigned *nbytes, #else #error please implement for this limb size. #endif - if (lzeros > 0) { + if (lzeros) { mpi_limb_t *limb1 = (void *)p - sizeof(alimb); mpi_limb_t *limb2 = (void *)p - sizeof(alimb) + lzeros; *limb1 = *limb2; p -= lzeros; y = lzeros; - lzeros -= sizeof(alimb); + lzeros = 0; } p = p - (sizeof(alimb) - y); |