Commit f75e582b authored by Xiaoke Wang's avatar Xiaoke Wang Committed by Rob Clark
Browse files

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: default avatarXiaoke Wang <xkernel.wang@foxmail.com>
Reviewed-by: default avatarAbhinav Kumar <quic_abhinavk@quicinc.com>
Link: https://lore.kernel.org/r/tencent_B3E19486FF39415098B572B7397C2936C309@qq.com


Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
parent 05241de1
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -176,6 +176,8 @@ void msm_disp_snapshot_add_block(struct msm_disp_state *disp_state, u32 len,
	va_list va;

	new_blk = kzalloc(sizeof(struct msm_disp_state_block), GFP_KERNEL);
	if (!new_blk)
		return;

	va_start(va, fmt);