Skip to content

Commit b131fa8

Browse files
Yang Yingliangwilldeacon
authored andcommitted
iommu/arm-smmu-v3: check return value after calling platform_get_resource()
It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value. Signed-off-by: Yang Yingliang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent d9ed8af commit b131fa8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3770,6 +3770,8 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
37703770

37713771
/* Base address */
37723772
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
3773+
if (!res)
3774+
return -EINVAL;
37733775
if (resource_size(res) < arm_smmu_resource_size(smmu)) {
37743776
dev_err(dev, "MMIO region too small (%pr)\n", res);
37753777
return -EINVAL;

0 commit comments

Comments
 (0)