Skip to content

Commit f75e582

Browse files
x2018robclark
authored andcommitted
drm/msm/disp: check the return value of kzalloc()
kzalloc() is a memory allocation function which can return NULL when some internal memory errors happen. So it is better to check it to prevent potential wrong memory access. Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com> Link: https://lore.kernel.org/r/tencent_B3E19486FF39415098B572B7397C2936C309@qq.com Signed-off-by: Rob Clark <robdclark@chromium.org>
1 parent 05241de commit f75e582

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ void msm_disp_snapshot_add_block(struct msm_disp_state *disp_state, u32 len,
176176
va_list va;
177177

178178
new_blk = kzalloc(sizeof(struct msm_disp_state_block), GFP_KERNEL);
179+
if (!new_blk)
180+
return;
179181

180182
va_start(va, fmt);
181183

0 commit comments

Comments
 (0)