[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220419181104.484667-8-sashal@kernel.org>
Date: Tue, 19 Apr 2022 14:10:35 -0400
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Xiaoke Wang <xkernel.wang@...mail.com>,
Abhinav Kumar <quic_abhinavk@...cinc.com>,
Rob Clark <robdclark@...omium.org>,
Sasha Levin <sashal@...nel.org>, robdclark@...il.com,
sean@...rly.run, airlied@...ux.ie, daniel@...ll.ch,
dmitry.baryshkov@...aro.org, greenfoo@....eu,
bjorn.andersson@...aro.org, linux-arm-msm@...r.kernel.org,
dri-devel@...ts.freedesktop.org, freedreno@...ts.freedesktop.org
Subject: [PATCH AUTOSEL 5.17 08/34] drm/msm/disp: check the return value of kzalloc()
From: Xiaoke Wang <xkernel.wang@...mail.com>
[ Upstream commit f75e582b0c3ee8f0bddc2248cc8b9175f29c5937 ]
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@...mail.com>
Reviewed-by: Abhinav Kumar <quic_abhinavk@...cinc.com>
Link: https://lore.kernel.org/r/tencent_B3E19486FF39415098B572B7397C2936C309@qq.com
Signed-off-by: Rob Clark <robdclark@...omium.org>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c | 2 ++
1 file changed, 2 insertions(+)
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);
--
2.35.1
Powered by blists - more mailing lists