diff options
| author | Stephan Mueller <smueller@chronox.de> | 2015-10-18 12:45:18 +0200 |
|---|---|---|
| committer | Mister Oyster <oysterized@gmail.com> | 2017-04-11 10:59:43 +0200 |
| commit | 783abbf8ddb50235bd5f0372661ee6232a90c80f (patch) | |
| tree | fe7457786a97c583d1dc9f180044c5b586ea6b7c /lib/mpi | |
| parent | c95a91fa627a2cadaeb9de3792f09de3e995ba59 (diff) | |
lib/mpi: fix off by one in mpi_read_raw_from_sgl
The patch fixes the analysis of the input data which contains an off
by one.
The issue is visible when the SGL contains one byte per SG entry.
The code for checking for zero bytes does not operate on the data byte.
Signed-off-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'lib/mpi')
| -rw-r--r-- | lib/mpi/mpicoder.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/mpi/mpicoder.c b/lib/mpi/mpicoder.c index c88429bb1..3db76b8c1 100644 --- a/lib/mpi/mpicoder.c +++ b/lib/mpi/mpicoder.c @@ -446,8 +446,11 @@ MPI mpi_read_raw_from_sgl(struct scatterlist *sgl, unsigned int len) const u8 *buff = sg_virt(sg); int len = sg->length; - while (len-- && !*buff++) + while (len && !*buff) { lzeros++; + len--; + buff++; + } if (len && *buff) break; |
