From: Dan Carpenter Date: Mon, 3 Dec 2018 14:50:11 +0000 (+0300) Subject: mailbox: ti-msgmgr: Off by one in ti_msgmgr_of_xlate() X-Git-Tag: v5.0-rc1~56^2~27 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=78f3ff524fca63e7d2a57149a34ade23d2c12798;p=thirdparty%2Flinux.git mailbox: ti-msgmgr: Off by one in ti_msgmgr_of_xlate() 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 Acked-by: Nishanth Menon Signed-off-by: Jassi Brar --- diff --git a/drivers/mailbox/ti-msgmgr.c b/drivers/mailbox/ti-msgmgr.c index 713d701b65689..6f6addd51d14c 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;