diff options
author | Nicolai Stange <nicstange@gmail.com> | 2016-05-26 23:19:53 +0200 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2016-05-31 16:42:00 +0800 |
commit | 7af791e0f0d00c14f01ba2ffe3b6e2b50a35fc6f (patch) | |
tree | 4ac6e6a42d23bbabe2d59dbd6cfd4678b226e12a /arch/arm64 | |
parent | c5ce7c697c983693c441573d2948e0ab8d62726e (diff) | |
download | op-kernel-dev-7af791e0f0d00c14f01ba2ffe3b6e2b50a35fc6f.zip op-kernel-dev-7af791e0f0d00c14f01ba2ffe3b6e2b50a35fc6f.tar.gz |
lib/mpi: mpi_read_from_buffer(): return -EINVAL upon too short buffer
Currently, if the input buffer is shorter than the expected length as
indicated by its first two bytes, an MPI instance of this expected length
will be allocated and filled with as much data as is available. The rest
will remain uninitialized.
Instead of leaving this condition undetected, an error code should be
reported to the caller.
Since this situation indicates that the input buffer's first two bytes,
encoding the number of expected bits, are garbled, -EINVAL is appropriate
here.
If the input buffer is shorter than indicated by its first two bytes,
make mpi_read_from_buffer() return -EINVAL.
Get rid of the 'nread' variable: with the new semantics, the total number
of bytes read from the input buffer is known in advance.
Signed-off-by: Nicolai Stange <nicstange@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'arch/arm64')
0 files changed, 0 insertions, 0 deletions