[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211215052157.94172-1-jiasheng@iscas.ac.cn>
Date: Wed, 15 Dec 2021 13:21:57 +0800
From: Jiasheng Jiang <jiasheng@...as.ac.cn>
To: tiffany.lin@...iatek.com, andrew-ct.chen@...iatek.com,
mchehab@...nel.org, matthias.bgg@...il.com
Cc: linux-media@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, linux-kernel@...r.kernel.org,
Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH v2] media: mtk-vcodec: potential dereference of null pointer
The return value of devm_kzalloc() needs to be checked.
To avoid use of null pointer in case of thefailure of alloc.
Fixes: 46233e91fa24 ("media: mtk-vcodec: move firmware implementations into their own files")
Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
---
Changelog:
v1 -> v2
*Change 1. Change the return value from "-EINVAL" to "-ENOMEM".
---
drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_vpu.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_vpu.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_vpu.c
index cd27f637dbe7..769228093e48 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_vpu.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_vpu.c
@@ -102,6 +102,8 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init(struct mtk_vcodec_dev *dev,
vpu_wdt_reg_handler(fw_pdev, mtk_vcodec_vpu_reset_handler, dev, rst_id);
fw = devm_kzalloc(&dev->plat_dev->dev, sizeof(*fw), GFP_KERNEL);
+ if (!fw)
+ return ERR_PTR(-ENOMEM);
fw->type = VPU;
fw->ops = &mtk_vcodec_vpu_msg;
fw->pdev = fw_pdev;
--
2.25.1
Powered by blists - more mailing lists