summaryrefslogtreecommitdiffstats
path: root/lib/iommu-common.c
diff options
context:
space:
mode:
authorNicolai Stange <nicstange@gmail.com>2016-05-26 23:19:53 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2016-05-31 16:42:00 +0800
commit7af791e0f0d00c14f01ba2ffe3b6e2b50a35fc6f (patch)
tree4ac6e6a42d23bbabe2d59dbd6cfd4678b226e12a /lib/iommu-common.c
parentc5ce7c697c983693c441573d2948e0ab8d62726e (diff)
downloadtalos-obmc-linux-7af791e0f0d00c14f01ba2ffe3b6e2b50a35fc6f.tar.gz
talos-obmc-linux-7af791e0f0d00c14f01ba2ffe3b6e2b50a35fc6f.zip
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 'lib/iommu-common.c')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud