> From: Christopher Li <[EMAIL PROTECTED]>
> Date: Wed, 5 Feb 2003 07:26:45 -0800

> Any comment?

>               /* min 8 byte setup packet, max arbitrary */
> -             if (uurb.buffer_length < 8 || uurb.buffer_length > PAGE_SIZE)
> +             if (uurb.buffer_length < 8 || (uurb.buffer_length >> 16))
>                       return -EINVAL;

Try not be too clever in C. The idiom is:

        if (size < N || size >= M)

> > >           /* min 8 byte setup packet, max arbitrary */
> > > -         if (uurb.buffer_length < 8 || uurb.buffer_length > PAGE_SIZE)
> > > +         if (uurb.buffer_length < 8 || uurb.buffer_length > 64*1024)
> > 
> > Still one byte off. It must fit into 16 bits.

In this case, all you had to do was:

 if (uurb.buffer_length < 8 || uurb.buffer_length >= 64*1024)

I do not remember when I used <= or > for the last time.
Years and years ago.

-- Pete


-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to