mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mailbox: ti-msgmgr: Off by one in ti_msgmgr_of_xlate()
@ 2018-12-03 14:50 Dan Carpenter
  2018-12-03 15:51 ` Nishanth Menon
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2018-12-03 14:50 UTC (permalink / raw)
  To: Jassi Brar, Nishanth Menon; +Cc: linux-kernel, kernel-janitors

The > comparison should be >= or we access one element beyond the end
of the array.

(The inst->qinsts[] array is allocated in the ti_msgmgr_probe() function
and it has ->num_valid_queues elements.)

Fixes: a2b79838b891 ("mailbox: ti-msgmgr: Add support for Secure Proxy")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/mailbox/ti-msgmgr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mailbox/ti-msgmgr.c b/drivers/mailbox/ti-msgmgr.c
index 713d701b6568..6f6addd51d14 100644
--- a/drivers/mailbox/ti-msgmgr.c
+++ b/drivers/mailbox/ti-msgmgr.c
@@ -547,7 +547,7 @@ static struct mbox_chan *ti_msgmgr_of_xlate(struct mbox_controller *mbox,
 	}
 
 	if (d->is_sproxy) {
-		if (req_pid > d->num_valid_queues)
+		if (req_pid >= d->num_valid_queues)
 			goto err;
 		qinst = &inst->qinsts[req_pid];
 		return qinst->chan;
-- 
2.11.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mailbox: ti-msgmgr: Off by one in ti_msgmgr_of_xlate()
  2018-12-03 14:50 [PATCH] mailbox: ti-msgmgr: Off by one in ti_msgmgr_of_xlate() Dan Carpenter
@ 2018-12-03 15:51 ` Nishanth Menon
  0 siblings, 0 replies; 2+ messages in thread
From: Nishanth Menon @ 2018-12-03 15:51 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Jassi Brar, linux-kernel, kernel-janitors

On 17:50-20181203, Dan Carpenter wrote:
> The > comparison should be >= or we access one element beyond the end
> of the array.
> 
> (The inst->qinsts[] array is allocated in the ti_msgmgr_probe() function
> and it has ->num_valid_queues elements.)
> 
> Fixes: a2b79838b891 ("mailbox: ti-msgmgr: Add support for Secure Proxy")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/mailbox/ti-msgmgr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mailbox/ti-msgmgr.c b/drivers/mailbox/ti-msgmgr.c
> index 713d701b6568..6f6addd51d14 100644
> --- a/drivers/mailbox/ti-msgmgr.c
> +++ b/drivers/mailbox/ti-msgmgr.c
> @@ -547,7 +547,7 @@ static struct mbox_chan *ti_msgmgr_of_xlate(struct mbox_controller *mbox,
>  	}
>  
>  	if (d->is_sproxy) {
> -		if (req_pid > d->num_valid_queues)
> +		if (req_pid >= d->num_valid_queues)
>  			goto err;
>  		qinst = &inst->qinsts[req_pid];
>  		return qinst->chan;
> -- 
> 2.11.0
> 

OOpps.. Thanks for catching it.

Acked-by: Nishanth Menon <nm@ti.com>

-- 
Regards,
Nishanth Menon

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-12-03 15:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-03 14:50 [PATCH] mailbox: ti-msgmgr: Off by one in ti_msgmgr_of_xlate() Dan Carpenter
2018-12-03 15:51 ` Nishanth Menon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®