lkml.org 
[lkml]   [2020]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH][next] dmaengine: ti: omap-dma: don't allow a null od->plat pointer to be dereferenced
Date
From: Colin Ian King <colin.king@canonical.com>

Currently when the call to dev_get_platdata returns null the driver issues
a warning and then later dereferences the null pointer. Avoid this issue
by returning -EPROBE_DEFER errror rather when the platform data is null.

Addresses-Coverity: ("Dereference after null check")
Fixes: 211010aeb097 ("dmaengine: ti: omap-dma: Pass sdma auxdata to driver and use it")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/dma/ti/omap-dma.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/ti/omap-dma.c b/drivers/dma/ti/omap-dma.c
index fc8f7b2fc7b3..335c3fa7a3b1 100644
--- a/drivers/dma/ti/omap-dma.c
+++ b/drivers/dma/ti/omap-dma.c
@@ -1658,8 +1658,10 @@ static int omap_dma_probe(struct platform_device *pdev)
if (conf) {
od->cfg = conf;
od->plat = dev_get_platdata(&pdev->dev);
- if (!od->plat)
+ if (!od->plat) {
dev_warn(&pdev->dev, "no sdma auxdata needed?\n");
+ return -EPROBE_DEFER;
+ }
} else {
od->cfg = &default_cfg;

--
2.24.0
\
 
 \ /
  Last update: 2020-01-06 13:23    [W:0.050 / U:2.424 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site