[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090211205854.GB2550@ami.dom.local>
Date: Wed, 11 Feb 2009 21:58:54 +0100
From: Jarek Poplawski <jarkao2@...il.com>
To: Roel Kluin <roel.kluin@...il.com>
Cc: "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] net: off by one, try #2
On Wed, Feb 11, 2009 at 09:27:55PM +0100, Jarek Poplawski wrote:
> On Wed, Feb 11, 2009 at 08:33:25PM +0100, Roel Kluin wrote:
...
One more thing below...
> > Signed-off-by: Roel Kluin <roel.kluin@...il.com>
> > ---
> > diff --git a/drivers/net/3c505.c b/drivers/net/3c505.c
> > index 6124605..4ade64a 100644
> > --- a/drivers/net/3c505.c
> > +++ b/drivers/net/3c505.c
> > @@ -493,15 +493,21 @@ static bool receive_pcb(struct net_device *dev, pcb_struct * pcb)
> > }
> > /* read the data */
> > spin_lock_irqsave(&adapter->lock, flags);
> > - i = 0;
> > - do {
> > - j = 0;
> > - while (((stat = get_status(dev->base_addr)) & ACRF) == 0 && j++ < 20000);
> > - pcb->data.raw[i++] = inb_command(dev->base_addr);
> > - if (i > MAX_PCB_DATA)
> > - INVALID_PCB_MSG(i);
> > - } while ((stat & ASF_PCB_MASK) != ASF_PCB_END && j < 20000);
> > + for (i = 0; i < MAX_PCB_DATA; i++) {
> > + for (j = 0; j < 20000; j++) {
> > + stat = get_status(dev->base_addr);
> > + if (stat & ACRF)
> > + break;
> > + }
> > + pcb->data.raw[i] = inb_command(dev->base_addr);
> > + if (stat & ASF_PCB_MASK == ASF_PCB_END || j >= 20000)
> > + break;
Here is no ++i after breaking the loop, so no need for [--i] later;
please, check this more.
Jarek P.
> > + }
> > spin_unlock_irqrestore(&adapter->lock, flags);
> > + if (i >= MAX_PCB_DATA) {
> > + INVALID_PCB_MSG(i);
> > + return false;
> > + }
> > if (j >= 20000) {
> > TIMEOUT_MSG(__LINE__);
> > return false;
> > diff --git a/drivers/net/irda/mcs7780.c b/drivers/net/irda/mcs7780.c
> > index 7eafdca..85e88da 100644
> > --- a/drivers/net/irda/mcs7780.c
> > +++ b/drivers/net/irda/mcs7780.c
> > @@ -585,7 +585,7 @@ static int mcs_speed_change(struct mcs_cb *mcs)
> > mcs_get_reg(mcs, MCS_RESV_REG, &rval);
> > } while(cnt++ < 100 && (rval & MCS_IRINTX));
> >
> > - if(cnt >= 100) {
> > + if (cnt > 100) {
> > IRDA_ERROR("unable to change speed\n");
> > ret = -EIO;
> > goto error;
> >
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists