Skip to content

Commit 96bc86c

Browse files
JiangJiasgregkh
authored andcommitted
drm/ast: potential dereference of null pointer
[ Upstream commit fea3fdf ] The return value of kzalloc() needs to be checked. To avoid use of null pointer '&ast_state->base' in case of the failure of alloc. Fixes: f0adbc3 ("drm/ast: Allocate initial CRTC state of the correct size") Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patchwork.freedesktop.org/patch/msgid/20211214014126.2211535-1-jiasheng@iscas.ac.cn Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent cac0fd4 commit 96bc86c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎drivers/gpu/drm/ast/ast_mode.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,10 @@ static void ast_crtc_reset(struct drm_crtc *crtc)
857857
if (crtc->state)
858858
crtc->funcs->atomic_destroy_state(crtc, crtc->state);
859859

860-
__drm_atomic_helper_crtc_reset(crtc, &ast_state->base);
860+
if (ast_state)
861+
__drm_atomic_helper_crtc_reset(crtc, &ast_state->base);
862+
else
863+
__drm_atomic_helper_crtc_reset(crtc, NULL);
861864
}
862865

863866
static struct drm_crtc_state *

0 commit comments

Comments
 (0)