[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1648112150-6515-1-git-send-email-unSimple1993@163.com>
Date: Thu, 24 Mar 2022 16:55:50 +0800
From: QintaoShen <unSimple1993@....com>
To: sean@...rly.run
Cc: quic_abhinavk@...cinc.com, robdclark@...il.com,
linux-kernel@...r.kernel.org, QintaoShen <unSimple1993@....com>
Subject: [PATCH v1] 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 <unSimple1993@....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
Powered by blists - more mailing lists