]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
mailbox: ti-msgmgr: Off by one in ti_msgmgr_of_xlate()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 3 Dec 2018 14:50:11 +0000 (17:50 +0300)
committerJassi Brar <jaswinder.singh@linaro.org>
Wed, 12 Dec 2018 02:32:45 +0000 (08:02 +0530)
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>
Acked-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
drivers/mailbox/ti-msgmgr.c

index 713d701b656892d2f9fe5d7008f30808d21936c8..6f6addd51d14cf9369d240c8c34053d14bd0e046 100644 (file)
@@ -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;