mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 03:10:12 +00:00
drm/rockchip: vop: fix possible null-ptr-deref in vop_bind()
[ Upstream commitf8c242908a
] 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. Fixes:2048e3286f
("drm: rockchip: Add basic drm driver") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Signed-off-by: Heiko Stuebner <heiko@sntech.de> Link: https://patchwork.freedesktop.org/patch/msgid/20220422032854.2995175-1-yangyingliang@huawei.com Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
56cc614cc7
commit
769c53bb61
1 changed files with 1 additions and 1 deletions
|
@ -2118,10 +2118,10 @@ static int vop_bind(struct device *dev, struct device *master, void *data)
|
|||
vop_win_init(vop);
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
vop->len = resource_size(res);
|
||||
vop->regs = devm_ioremap_resource(dev, res);
|
||||
if (IS_ERR(vop->regs))
|
||||
return PTR_ERR(vop->regs);
|
||||
vop->len = resource_size(res);
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
|
||||
if (res) {
|
||||
|
|
Loading…
Reference in a new issue