drm/msm: Check for NULL return of kzalloc()
Subsystems (2)
PATCH 1/1 drm/msm: Check for NULL return of kzalloc()
The allocation of kzalloc() may return NULL, which would bring a NULL pointer dereference bug.
To avoid this confusion, it is better to check the return value of kzalloc().
Signed-off-by QintaoShen <[email protected]>
--- drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c +2 -0
@@ -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);
Signature · 1 line
2.7.4