OSDN Git Service

hw/sd: fix out-of-bounds check for multi block reads
authorMichael Olbrich <m.olbrich@pengutronix.de>
Fri, 6 Oct 2017 15:46:47 +0000 (16:46 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 6 Oct 2017 15:46:47 +0000 (16:46 +0100)
commit8573378e62d19e25a2434e23462ec99ef4d065ac
tree4027b635b14abdd06a74aaf13212c094247bbacb
parent77077a83006c3c9bdca496727f1735a3c5c5355d
hw/sd: fix out-of-bounds check for multi block reads

The current code checks if the next block exceeds the size of the card.
This generates an error while reading the last block of the card.
Do the out-of-bounds check when starting to read a new block to fix this.

This issue became visible with increased error checking in Linux 4.13.

Cc: qemu-stable@nongnu.org
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
Message-id: 20170916091611.10241-1-m.olbrich@pengutronix.de
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/sd/sd.c