Skip to content

Commit e9bef62

Browse files
Ethan Tidmoregregkh
authored andcommitted
drm/sun4i: backend: fix error pointer dereference
[ Upstream commit 0627798 ] The function drm_atomic_get_plane_state() can return an error pointer and is not checked for it. Add error pointer check. Detected by Smatch: drivers/gpu/drm/sun4i/sun4i_backend.c:496 sun4i_backend_atomic_check() error: 'plane_state' dereferencing possible ERR_PTR() Fixes: 96180dd ("drm/sun4i: backend: Add a custom atomic_check for the frontend") Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com> Reviewed-by: Chen-Yu Tsai <wens@kernel.org> Link: https://patch.msgid.link/20260217014801.60760-1-ethantidmore06@gmail.com Signed-off-by: Chen-Yu Tsai <wens@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 85c3277 commit e9bef62

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/gpu/drm/sun4i/sun4i_backend.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,9 @@ static int sun4i_backend_atomic_check(struct sunxi_engine *engine,
491491
drm_for_each_plane_mask(plane, drm, crtc_state->plane_mask) {
492492
struct drm_plane_state *plane_state =
493493
drm_atomic_get_plane_state(state, plane);
494+
if (IS_ERR(plane_state))
495+
return PTR_ERR(plane_state);
496+
494497
struct sun4i_layer_state *layer_state =
495498
state_to_sun4i_layer_state(plane_state);
496499
struct drm_framebuffer *fb = plane_state->fb;

0 commit comments

Comments
 (0)