]> git.baikalelectronics.ru Git - kernel.git/commit
iommu/dart: check return value after calling platform_get_resource()
authorYang Yingliang <yangyingliang@huawei.com>
Mon, 25 Apr 2022 09:08:26 +0000 (17:08 +0800)
committerJoerg Roedel <jroedel@suse.de>
Thu, 28 Apr 2022 09:38:44 +0000 (11:38 +0200)
commit744329c3ef9d3160774772c9ba52e4a844d0c75b
tree5cdf4260383fbf806c69c1bd271dd5c7dd30ee94
parent8ecdc0851d5eee6153bc2c710d7cee79efdd42f1
iommu/dart: check return value after calling platform_get_resource()

It will cause null-ptr-deref in resource_size(), if platform_get_resource()
returns NULL, move calling resource_size() after devm_ioremap_resource() that
will check 'res' to avoid null-ptr-deref.
And use devm_platform_get_and_ioremap_resource() to simplify code.

Fixes: d90d7ce2406d ("iommu/dart: Add DART iommu driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Sven Peter <sven@svenpeter.dev>
Link: https://lore.kernel.org/r/20220425090826.2532165-1-yangyingliang@huawei.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/apple-dart.c