[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1534863967.5009.7.camel@pengutronix.de>
Date: Tue, 21 Aug 2018 17:06:07 +0200
From: Philipp Zabel <p.zabel@...gutronix.de>
To: Houlong Wei <houlong.wei@...iatek.com>,
Jassi Brar <jassisinghbrar@...il.com>,
Matthias Brugger <matthias.bgg@...il.com>
Cc: Dan Carpenter <dan.carpenter@...cle.com>,
Nicolas Boichat <drinkcat@...omium.org>,
srv_heupstream@...iatek.com,
Daoyuan Huang <daoyuan.huang@...iatek.com>,
linux-kernel@...r.kernel.org, Daniel Kurtz <djkurtz@...omium.org>,
HS Liao <hs.liao@...iatek.com>,
Dennis-YC Hsieh <dennis-yc.hsieh@...iatek.com>,
YT Shen <yt.shen@...iatek.com>,
Monica Wang <monica.wang@...iatek.com>,
linux-mediatek@...ts.infradead.org,
Sascha Hauer <kernel@...gutronix.de>, enzhu.wang@...iatek.com,
CK HU <ck.hu@...iatek.com>,
Jiaguang Zhang <jiaguang.zhang@...iatek.com>,
Bibby Hsieh <bibby.hsieh@...iatek.com>,
linux-arm-kernel@...ts.infradead.org, ginny.chen@...iatek.com
Subject: Re: [PATCH] mailbox: mediatek: Add check for possible failure of
kzalloc
On Tue, 2018-08-21 at 18:22 +0800, Houlong Wei wrote:
> The patch 623a6143a845("mailbox: mediatek: Add Mediatek CMDQ driver")
> introduce the following static checker warning:
> drivers/mailbox/mtk-cmdq-mailbox.c:366 cmdq_mbox_send_data()
> error: potential null dereference 'task'. (kzalloc returns null)
>
> Fixes: 623a6143a845 ("mailbox: mediatek: Add Mediatek CMDQ driver")
> Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
> Signed-off-by: Houlong Wei <houlong.wei@...iatek.com>
> ---
> drivers/mailbox/mtk-cmdq-mailbox.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c
> index aec46d5..f7cc29c 100644
> --- a/drivers/mailbox/mtk-cmdq-mailbox.c
> +++ b/drivers/mailbox/mtk-cmdq-mailbox.c
> @@ -363,6 +363,9 @@ static int cmdq_mbox_send_data(struct mbox_chan *chan, void *data)
> WARN_ON(cmdq->suspended);
>
> task = kzalloc(sizeof(*task), GFP_ATOMIC);
> + if (!task)
> + return -ENOMEM;
> +
> task->cmdq = cmdq;
> INIT_LIST_HEAD(&task->list_entry);
> task->pa_base = pkt->pa_base;
Reviewed-by: Philipp Zabel <p.zabel@...gutronix.de>
regards
Philipp
Powered by blists - more mailing lists