projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6a47a16
)
drm/rockchip: vop: fix possible null-ptr-deref in vop_bind()
author
Yang Yingliang
<yangyingliang@huawei.com>
Fri, 22 Apr 2022 03:28:54 +0000
(11:28 +0800)
committer
Heiko Stuebner
<heiko@sntech.de>
Mon, 2 May 2022 21:22:05 +0000
(23:22 +0200)
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: 2048e3286f34 ("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
drivers/gpu/drm/rockchip/rockchip_drm_vop.c
patch
|
blob
|
history
diff --git
a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 3e8d9e2d1b675c5f3eb56e99a7f3c0997f7d0fb9..d53037531f40783a9119cb5dd3fca3baad154965 100644
(file)
--- a/
drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/
drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@
-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) {