mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/mediatek: mtk_drm_crtc: Add checks for devm_kcalloc
@ 2022-12-05  9:51 ruanjinjie
  2022-12-05 11:52 ` AngeloGioacchino Del Regno
  0 siblings, 1 reply; 3+ messages in thread
From: ruanjinjie @ 2022-12-05  9:51 UTC (permalink / raw)
  To: chunkuang.hu, p.zabel, airlied, daniel, matthias.bgg, seanpaul,
	ck.hu, dri-devel, linux-mediatek, linux-arm-kernel, linux-kernel
  Cc: ruanjinjie

As the devm_kcalloc may return NULL, the return value needs to be checked
to avoid NULL poineter dereference.

Fixes: 31c5558dae05 ("drm/mediatek: Refactor plane init")
Signed-off-by: ruanjinjie <ruanjinjie@huawei.com>
---
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index 112615817dcb..5071f1263216 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -945,6 +945,8 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
 
 	mtk_crtc->planes = devm_kcalloc(dev, num_comp_planes,
 					sizeof(struct drm_plane), GFP_KERNEL);
+	if (!mtk_crtc->planes)
+		return -ENOMEM;
 
 	for (i = 0; i < mtk_crtc->ddp_comp_nr; i++) {
 		ret = mtk_drm_crtc_init_comp_planes(drm_dev, mtk_crtc, i,
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/mediatek: mtk_drm_crtc: Add checks for devm_kcalloc
  2022-12-05  9:51 [PATCH] drm/mediatek: mtk_drm_crtc: Add checks for devm_kcalloc ruanjinjie
@ 2022-12-05 11:52 ` AngeloGioacchino Del Regno
  2023-01-27 14:55   ` Chun-Kuang Hu
  0 siblings, 1 reply; 3+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-12-05 11:52 UTC (permalink / raw)
  To: ruanjinjie, chunkuang.hu, p.zabel, airlied, daniel, matthias.bgg,
	seanpaul, ck.hu, dri-devel, linux-mediatek, linux-arm-kernel,
	linux-kernel

Il 05/12/22 10:51, ruanjinjie ha scritto:
> As the devm_kcalloc may return NULL, the return value needs to be checked
> to avoid NULL poineter dereference.
> 
> Fixes: 31c5558dae05 ("drm/mediatek: Refactor plane init")
> Signed-off-by: ruanjinjie <ruanjinjie@huawei.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/mediatek: mtk_drm_crtc: Add checks for devm_kcalloc
  2022-12-05 11:52 ` AngeloGioacchino Del Regno
@ 2023-01-27 14:55   ` Chun-Kuang Hu
  0 siblings, 0 replies; 3+ messages in thread
From: Chun-Kuang Hu @ 2023-01-27 14:55 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: ruanjinjie, chunkuang.hu, p.zabel, airlied, daniel, matthias.bgg,
	seanpaul, ck.hu, dri-devel, linux-mediatek, linux-arm-kernel,
	linux-kernel

Hi, Ruanjinjie:

Applied to mediatek-drm-next [1], thanks.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next

Regards,
Chun-Kuang.

AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> 於
2022年12月5日 週一 下午7:53寫道:
>
> Il 05/12/22 10:51, ruanjinjie ha scritto:
> > As the devm_kcalloc may return NULL, the return value needs to be checked
> > to avoid NULL poineter dereference.
> >
> > Fixes: 31c5558dae05 ("drm/mediatek: Refactor plane init")
> > Signed-off-by: ruanjinjie <ruanjinjie@huawei.com>
>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-27 14:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-05  9:51 [PATCH] drm/mediatek: mtk_drm_crtc: Add checks for devm_kcalloc ruanjinjie
2022-12-05 11:52 ` AngeloGioacchino Del Regno
2023-01-27 14:55   ` Chun-Kuang Hu

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®