* [PATCH v1] drm/msm: Check for NULL return of kzalloc()
@ 2022-03-24 8:55 QintaoShen
0 siblings, 0 replies; only message in thread
From: QintaoShen @ 2022-03-24 8:55 UTC (permalink / raw)
To: sean; +Cc: quic_abhinavk, robdclark, linux-kernel, QintaoShen
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 <unSimple1993@163.com>
---
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 5d2ff67..d017deb 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.7.4
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-03-24 8:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-24 8:55 [PATCH v1] drm/msm: Check for NULL return of kzalloc() QintaoShen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®