Tim Wawrzynczak has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/34787 )
Change subject: soc/nvidia/tegra210: Fix potential NULL pointer dereference ......................................................................
soc/nvidia/tegra210: Fix potential NULL pointer dereference
Recent Coverity scan indicated potential NULL deference; spi->dma_in and spi->dma_out are set to NULL after a cycle finishes, and a spurious call to this could segfault
Change-Id: Icd1412f0956c0a4a75266d1873d5e9848aceee32 Signed-off-by: Tim Wawrzynczak twawrzynczak@chromium.org --- M src/soc/nvidia/tegra210/spi.c 1 file changed, 5 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/87/34787/1
diff --git a/src/soc/nvidia/tegra210/spi.c b/src/soc/nvidia/tegra210/spi.c index 9310e0c..d392f70 100644 --- a/src/soc/nvidia/tegra210/spi.c +++ b/src/soc/nvidia/tegra210/spi.c @@ -574,6 +574,11 @@
struct apb_dma * const apb_dma = (struct apb_dma *)TEGRA_APB_DMA_BASE;
+ if (spi->dma_in == NULL || spi->dma_out == NULL) { + ret = -1; + goto done; + } + todo = read32(&spi->dma_in->regs->wcount);
if (spi->dma_in) {