diff options
author | Xiaoke Wang <xkernel.wang@foxmail.com> | 2022-03-24 17:15:08 +0800 |
---|---|---|
committer | Rob Clark <robdclark@chromium.org> | 2022-04-06 09:13:46 -0700 |
commit | f75e582b0c3ee8f0bddc2248cc8b9175f29c5937 (patch) | |
tree | a720ac69e01e0754438399b8922529fe1ec2a5d6 /drivers/gpu | |
parent | 05241de1f69eb7f56b0a5e0bec96a7752fad1b2f (diff) |
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>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c b/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c index 5d2ff6791058..acfe1b31e079 100644 --- a/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c +++ b/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c @@ -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); |