Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5218259imm; Tue, 21 Aug 2018 08:07:47 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxLcOLF8bGPgf87Ii6IHbGO1xf50fnBPfGM3/1ZRspCre2UDn0PfMa9AwIAxXPk2MUz+bWe X-Received: by 2002:a17:902:1566:: with SMTP id b35-v6mr50118627plh.135.1534864067827; Tue, 21 Aug 2018 08:07:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534864067; cv=none; d=google.com; s=arc-20160816; b=Gf0GvsK/prb8QXFHy9s/jOP/TahGooB/DF6Ruccr+odXjof9SCGxArytP7vBHdeWdd lf1p9bG19NV2N9P/Lt+wgvp6bcB3Tf7ATHM0UbLaaleuMrZApjej5lxIZ5HcNTPFkizN LKkvqHazLXR3Au8yxpERuI4JYp5F9MOMIdpXu1N1xnlbS99as5zonbWauTjJLPpZrIxO lglCyV200Jev9nFC8lA+ZaJiG6uK4M5tdInzc99NvEpEBM++4Xglq2ItM/iTPCvPTyk4 gELuOCs6AU3JT/oyggKHj9Kt+9hml2iLgAfUyBfhQfQ49vEp2tz1lDYuybt/x/eoONT9 ixIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=WqF1FTvblCBTV/O6+h153phMapqRR/2iPKRSq+gYBTM=; b=kjVjAK5mbg6FLD00qsxMnBKWYOoGVAwHqY5zCWbYINiwladpFpPRhyrwaD2wl49TzA DryhqmJ9K0LXIPKcnPBrZYvt03xbiuXaFqj/4Nus0E+01aJ4TmHytKLnduRyJLTQfpV8 U+ItZ8ixVe3wjh5tAaEdDrEzq0f3cCcteHAg98Osiy9GXoQ8dLeN/05dvrAl6c2TO8Cc hxXJ4spWBiD/eRSvKQrAxTCH7fWUT4B3t9VzeiIsLAVCg0aBkuXhRBrRGCg4yWWgJ7kk wl8S7Gnu2xmwasWp8+ytSEB5rBE4DIiHYU/577l/UWceiFfhZoYFPqygwfLrJZIXRy5S njUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y2-v6si3135412pga.645.2018.08.21.08.07.29; Tue, 21 Aug 2018 08:07:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727569AbeHUS0y (ORCPT + 99 others); Tue, 21 Aug 2018 14:26:54 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:55701 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726743AbeHUS0y (ORCPT ); Tue, 21 Aug 2018 14:26:54 -0400 Received: from lupine.hi.pengutronix.de ([2001:67c:670:100:3ad5:47ff:feaf:1a17] helo=lupine) by metis.ext.pengutronix.de with esmtp (Exim 4.89) (envelope-from ) id 1fs8EU-0000CF-UV; Tue, 21 Aug 2018 17:06:10 +0200 Message-ID: <1534863967.5009.7.camel@pengutronix.de> Subject: Re: [PATCH] mailbox: mediatek: Add check for possible failure of kzalloc From: Philipp Zabel To: Houlong Wei , Jassi Brar , Matthias Brugger Cc: Dan Carpenter , Nicolas Boichat , srv_heupstream@mediatek.com, Daoyuan Huang , linux-kernel@vger.kernel.org, Daniel Kurtz , HS Liao , Dennis-YC Hsieh , YT Shen , Monica Wang , linux-mediatek@lists.infradead.org, Sascha Hauer , enzhu.wang@mediatek.com, CK HU , Jiaguang Zhang , Bibby Hsieh , linux-arm-kernel@lists.infradead.org, ginny.chen@mediatek.com Date: Tue, 21 Aug 2018 17:06:07 +0200 In-Reply-To: <1534846964-13224-1-git-send-email-houlong.wei@mediatek.com> References: <1534846964-13224-1-git-send-email-houlong.wei@mediatek.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6-1+deb9u1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:100:3ad5:47ff:feaf:1a17 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Signed-off-by: Houlong Wei > --- > 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 regards Philipp