Re: [patch] ipw2x00: signedness bug handling frame length

Dan Carpenter
2012-01-13T10:36:24Z

[-- Attachment #1: Type: text/plain, Size: 1003 bytes --]

On Fri, Jan 13, 2012 at 11:29:09AM +0100, Stanislaw Gruszka wrote:
> On Thu, Jan 12, 2012 at 09:34:50AM +0300, Dan Carpenter wrote:
> > This is basically just a cleanup. Large positive numbers get counted as
> > negative but then get implicitly cast to positive again for the checks
> > that matter.
> >
> > This does make a small difference in ipw_handle_promiscuous_rx() when we
> > test "if (unlikely((len + IPW_RX_FRAME_SIZE) > skb_tailroom(rxb->skb)))"
> > It should return there, but we don't return until a couple lines later
> > when we test "if (len > IPW_RX_BUF_SIZE - sizeof(struct ipw_rt_hdr)) {".
> > The difference is that in the second test the sizeof() means that there
> > is an implied cast to unsigned.
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> Not sure if making it "unsinged int" would be better, but this change is
> fine to me as is too.

Yeah. You're probably right... Next time, I'll do it that way. ;)

regards,
dan carpenter

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]