Skip to contentSkip to conversation

mailbox: mtk-vcp-mailbox: Fix the return value in mtk_vcp_mbox_xlate()

PATCH Applied Felix Gu 2 participants 2 messages Feb 25 – Mar 29

Subsystems (2)
lore
Share & tools
lore

Felix Gu

author
#0 lore raw

PATCH 1/1 mailbox: mtk-vcp-mailbox: Fix the return value in mtk_vcp_mbox_xlate()

The return value of mtk_vcp_mbox_xlate() is checked by IS_ERR(), so return NULL is incorrect and could lead to a NULL pointer dereference.

Fixes b562abd95672 ("mailbox: mediatek: Add mtk-vcp-mailbox driver")
---
 drivers/mailbox/mtk-vcp-mailbox.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mailbox/mtk-vcp-mailbox.c +1 -1
index cedad575528f..1b291b8ea15a 100644
@@ -50,7 +50,7 @@ static struct mbox_chan *mtk_vcp_mbox_xlate(struct mbox_controller *mbox,
 					    const struct of_phandle_args *sp)
 {
 	if (sp->args_count)
-		return NULL;
+		return ERR_PTR(-EINVAL);
 
 	return &mbox->chans[0];
 }

---
base-commit: 3ef088b0c5772a6f75634e54aa34f5fc0a2c041c
change-id: 20260225-vcp-3a853447202e

Best regards,

Signature · 1 line
Felix Gu <[email protected]>
maintainer Applied
#1 lore raw
Quoted 16 lines · Felix Gu

The return value of mtk_vcp_mbox_xlate() is checked by IS_ERR(), so return NULL is incorrect and could lead to a NULL pointer dereference.

Fixes b562abd95672 ("mailbox: mediatek: Add mtk-vcp-mailbox driver")
---
 drivers/mailbox/mtk-vcp-mailbox.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mailbox/mtk-vcp-mailbox.c +0 -0
index cedad575528f..1b291b8ea15a 100644

drivers/mailbox/mtk-vcp-mailbox.c static struct mbox_chan *mtk_vcp_mbox_xlate(struct mbox_controller *mbox, · line 56

Quoted 8 lines
drivers/mailbox/mtk-vcp-mailbox.c +1 -1
@@ -50,7 +50,7 @@ static struct mbox_chan *mtk_vcp_mbox_xlate(struct mbox_controller *mbox,
                                            const struct of_phandle_args *sp)
 {
        if (sp->args_count)
-               return NULL;
+               return ERR_PTR(-EINVAL);
 
        return &mbox->chans[0];
 }

Applied to mailbox/for-next
Thanks
Jassi