From 236366b1aeaaf8a72bc032522e028bc2061e757d Mon Sep 17 00:00:00 2001 From: Joe Zhou Date: Thu, 8 Dec 2016 17:30:25 -0800 Subject: Marvell/Drivers: MvSpiDxe: Fix write bug This patch prevents possible NULL pointer dereference during SPI transfers. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Joe Zhou Signed-off-by: Marcin Wojtas Reviewed-by: Leif Lindholm --- Platform/Marvell/Drivers/Spi/MvSpiDxe.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Platform/Marvell') diff --git a/Platform/Marvell/Drivers/Spi/MvSpiDxe.c b/Platform/Marvell/Drivers/Spi/MvSpiDxe.c index 968ebf6bc6..3b491479ec 100755 --- a/Platform/Marvell/Drivers/Spi/MvSpiDxe.c +++ b/Platform/Marvell/Drivers/Spi/MvSpiDxe.c @@ -226,9 +226,8 @@ MvSpiTransfer ( // Wait for memory ready for (Iterator = 0; Iterator < SPI_TIMEOUT; Iterator++) { if (MmioRead32 (SpiRegBase + SPI_INT_CAUSE_REG)) { - *DataInPtr = MmioRead32 (SpiRegBase + SPI_DATA_IN_REG); - if (DataInPtr != NULL) { + *DataInPtr = MmioRead32 (SpiRegBase + SPI_DATA_IN_REG); DataInPtr++; } if (DataOutPtr != NULL) { -- cgit v1.2.3