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:
parent
1a7917210b
commit
89f26e6b7b
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user