Patchwork [-next] bna: off by one in bfa_msgq_rspq_pi_update()

login
register
mail settings
Submitter Dan Carpenter
Date Aug. 24, 2011, 11:30 a.m.
Message ID <20110824113028.GD5975@shale.localdomain>
Download mbox | patch
Permalink /patch/111323/
State Accepted
Delegated to: David Miller
Headers show

Comments

Dan Carpenter - Aug. 24, 2011, 11:30 a.m.
The rspq->rsphdlr[] array has BFI_MC_MAX elements, so this test was
off by one.

Signed-off-by: Dan Carpenter <error27@gmail.com>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rasesh Mody - Aug. 24, 2011, 5:33 p.m.
>From: Dan Carpenter [mailto:error27@gmail.com]
>Sent: Wednesday, August 24, 2011 4:30 AM
>
>The rspq->rsphdlr[] array has BFI_MC_MAX elements, so this test was
>off by one.
>
>Signed-off-by: Dan Carpenter <error27@gmail.com>
>
>diff --git a/drivers/net/ethernet/brocade/bna/bfa_msgq.c
>b/drivers/net/ethernet/brocade/bna/bfa_msgq.c
>index ed52187..dd36427 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);

Acked-by: Rasesh Mody <rmody@brocade.com>

Thanks,
Rasesh

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Aug. 26, 2011, 4:51 p.m.
From: Dan Carpenter <error27@gmail.com>
Date: Wed, 24 Aug 2011 14:30:28 +0300

> The rspq->rsphdlr[] array has BFI_MC_MAX elements, so this test was
> off by one.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/ethernet/brocade/bna/bfa_msgq.c b/drivers/net/ethernet/brocade/bna/bfa_msgq.c
index ed52187..dd36427 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);