From: Dan Carpenter Date: Wed, 24 Aug 2011 01:30:28 +0000 (+0000) Subject: bna: off by one in bfa_msgq_rspq_pi_update() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=18cf1248eca3f1fc38e12b314a6cadd286260e65;p=openwrt%2Fstaging%2Fblogic.git bna: off by one in bfa_msgq_rspq_pi_update() The rspq->rsphdlr[] array has BFI_MC_MAX elements, so this test was off by one. Signed-off-by: Dan Carpenter Acked-by: Rasesh Mody Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/brocade/bna/bfa_msgq.c b/drivers/net/ethernet/brocade/bna/bfa_msgq.c index ed5218782787..dd36427f4752 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_msgq.c +++ b/drivers/net/ethernet/brocade/bna/bfa_msgq.c @@ -483,7 +483,7 @@ bfa_msgq_rspq_pi_update(struct bfa_msgq_rspq *rspq, struct bfi_mbmsg *mb) mc = msghdr->msg_class; num_entries = ntohs(msghdr->num_entries); - if ((mc > BFI_MC_MAX) || (rspq->rsphdlr[mc].cbfn == NULL)) + if ((mc >= BFI_MC_MAX) || (rspq->rsphdlr[mc].cbfn == NULL)) break; (rspq->rsphdlr[mc].cbfn)(rspq->rsphdlr[mc].cbarg, msghdr);