Commit 92b300c4 authored by Chen-Yu Tsai's avatar Chen-Yu Tsai Committed by Maxime Ripard

drm/sun4i: Check return value of drm_vblank_init

drm_vblank_init can fail due to insufficient memory. Ignoring the error
and proceeding may cause the kernel to dereference an invalid pointer
when vblank is enabled.
Signed-off-by: default avatarChen-Yu Tsai <wens@csie.org>
Signed-off-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
parent 9d56defb
......@@ -102,7 +102,11 @@ static int sun4i_drv_bind(struct device *dev)
}
drm->dev_private = drv;
drm_vblank_init(drm, 1);
/* drm_vblank_init calls kcalloc, which can fail */
ret = drm_vblank_init(drm, 1);
if (ret)
goto free_drm;
drm_mode_config_init(drm);
ret = component_bind_all(drm->dev, drm);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment