Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/rockchip: vop2: Don't crash for invalid duplicate_state

It's possible for users to try to duplicate the CRTC state even when the
state doesn't exist. drm_atomic_helper_crtc_duplicate_state() (and other
users of __drm_atomic_helper_crtc_duplicate_state()) already guard this
with a WARN_ON() instead of crashing, so let's do that here too.

Fixes: 604be85547ce ("drm/rockchip: Add VOP2 driver")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20230621223311.2239547-5-jonas@kwiboo.se

authored by

Jonas Karlman and committed by
Heiko Stuebner
342f7e49 5aacd290

+5 -3
+5 -3
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
··· 2098 2098 2099 2099 static struct drm_crtc_state *vop2_crtc_duplicate_state(struct drm_crtc *crtc) 2100 2100 { 2101 - struct rockchip_crtc_state *vcstate, *old_vcstate; 2101 + struct rockchip_crtc_state *vcstate; 2102 2102 2103 - old_vcstate = to_rockchip_crtc_state(crtc->state); 2103 + if (WARN_ON(!crtc->state)) 2104 + return NULL; 2104 2105 2105 - vcstate = kmemdup(old_vcstate, sizeof(*old_vcstate), GFP_KERNEL); 2106 + vcstate = kmemdup(to_rockchip_crtc_state(crtc->state), 2107 + sizeof(*vcstate), GFP_KERNEL); 2106 2108 if (!vcstate) 2107 2109 return NULL; 2108 2110