[PATCH] dmaengine: mv_xor: fix to avoid potential NULL pointer dereference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



of_match_device() may fail and returns a NULL pointer.

Fix this by checking the return value of of_match_device().

Fixes: dd130c652cb7 ("dmaengine: mv_xor: use SoC type instead of directly the operation mode")
Signed-off-by: Zhang Shurong <zhang_shurong@xxxxxxxxxxx>
---
 drivers/dma/mv_xor.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index 23b232b57518..317815ec1dd6 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -1333,6 +1333,9 @@ static int mv_xor_probe(struct platform_device *pdev)
 			of_match_device(mv_xor_dt_ids,
 					&pdev->dev);
 
+		if (!of_id)
+			return -ENODEV;
+
 		xordev->xor_type = (uintptr_t)of_id->data;
 	}
 
-- 
2.30.2




[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux