summaryrefslogtreecommitdiff
path: root/Platform
diff options
context:
space:
mode:
authorJoe Zhou <shjzhou@marvell.com>2016-12-08 17:30:25 -0800
committerMarcin Wojtas <mw@semihalf.com>2017-10-05 16:42:07 +0200
commit236366b1aeaaf8a72bc032522e028bc2061e757d (patch)
tree68f8bf6b442ef4b81aa254f28e01a2c5cff1f4aa /Platform
parent19b01e5407d2e4694126bd320588109cd255a088 (diff)
downloadedk2-platforms-236366b1aeaaf8a72bc032522e028bc2061e757d.tar.xz
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 <shjzhou@marvell.com> Signed-off-by: Marcin Wojtas <mw@semihalf.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Diffstat (limited to 'Platform')
-rwxr-xr-xPlatform/Marvell/Drivers/Spi/MvSpiDxe.c3
1 files changed, 1 insertions, 2 deletions
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) {