Skip to content

Commit fea3fdf

Browse files
JiangJiastdz
authored andcommitted
drm/ast: potential dereference of null pointer
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
1 parent 5cf0606 commit fea3fdf

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
@@ -1121,7 +1121,10 @@ static void ast_crtc_reset(struct drm_crtc *crtc)
11211121
if (crtc->state)
11221122
crtc->funcs->atomic_destroy_state(crtc, crtc->state);
11231123

1124-
__drm_atomic_helper_crtc_reset(crtc, &ast_state->base);
1124+
if (ast_state)
1125+
__drm_atomic_helper_crtc_reset(crtc, &ast_state->base);
1126+
else
1127+
__drm_atomic_helper_crtc_reset(crtc, NULL);
11251128
}
11261129

11271130
static struct drm_crtc_state *

0 commit comments

Comments
 (0)