mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
hw/arm/omap_gpmc: Avoid buffer overrun filling prefetch FIFO
In fill_prefetch_fifo(), if the device we are reading from is 16 bit, then we must not try to transfer an odd number of bytes into the FIFO. This could otherwise have resulted in our overrunning the prefetch.fifo array by one byte. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
This commit is contained in:
@@ -242,6 +242,10 @@ static void fill_prefetch_fifo(struct omap_gpmc_s *s)
|
||||
if (bytes > s->prefetch.count) {
|
||||
bytes = s->prefetch.count;
|
||||
}
|
||||
if (is16bit) {
|
||||
bytes &= ~1;
|
||||
}
|
||||
|
||||
s->prefetch.count -= bytes;
|
||||
s->prefetch.fifopointer += bytes;
|
||||
fptr = 64 - s->prefetch.fifopointer;
|
||||
|
||||
Reference in New Issue
Block a user