From: Nicolai Stange Date: Tue, 22 Mar 2016 12:12:37 +0000 (+0100) Subject: lib/mpi: mpi_write_sgl(): purge redundant pointer arithmetic X-Git-Tag: v4.14-rc1~3089^2~65 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ea122be0b8f788b30e71ed5536fddc05f5ddff86;p=platform%2Fkernel%2Flinux-rpi.git lib/mpi: mpi_write_sgl(): purge redundant pointer arithmetic Within the copying loop in mpi_write_sgl(), we have if (lzeros) { ... p -= lzeros; y = lzeros; } p = p - (sizeof(alimb) - y); If lzeros == 0, then y == 0, too. Thus, lzeros gets subtracted and added back again to p. Purge this redundancy. Signed-off-by: Nicolai Stange Signed-off-by: Herbert Xu --- diff --git a/lib/mpi/mpicoder.c b/lib/mpi/mpicoder.c index d8b372b..78ec4e1 100644 --- a/lib/mpi/mpicoder.c +++ b/lib/mpi/mpicoder.c @@ -407,12 +407,11 @@ int mpi_write_to_sgl(MPI a, struct scatterlist *sgl, unsigned *nbytes, mpi_limb_t *limb2 = (void *)p - sizeof(alimb) + lzeros; *limb1 = *limb2; - p -= lzeros; y = lzeros; lzeros = 0; } - p = p - (sizeof(alimb) - y); + p = p - sizeof(alimb); for (x = 0; x < sizeof(alimb) - y; x++) { if (!buf_len) {