]> Git Repo - J-linux.git/commitdiff
mailbox: mediatek: Add check for possible failure of kzalloc
authorHoulong Wei <[email protected]>
Tue, 21 Aug 2018 10:22:44 +0000 (18:22 +0800)
committerJassi Brar <[email protected]>
Sat, 29 Sep 2018 07:12:39 +0000 (12:42 +0530)
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 <[email protected]>
Signed-off-by: Houlong Wei <[email protected]>
Reviewed-by: Philipp Zabel <[email protected]>
Signed-off-by: Jassi Brar <[email protected]>
drivers/mailbox/mtk-cmdq-mailbox.c

index aec46d5d3506181a7dc34bee920d80645c2c95f0..f7cc29c00302a493ee4136fe41273775b706c35a 100644 (file)
@@ -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;
This page took 0.061656 seconds and 4 git commands to generate.