On Monday 11 February 2008, Jean-Christophe Dubois wrote:
> On Saturday 09 February 2008 10:51:06 David Brownell wrote:
> > So I'd rather see a one-line fix to the RNDIS host code, instead of
> > this more elaborate approach.  Could you give that a try?
> 
> So here is the new proposal.

Which presumably works for your device ...  it's looks mostly
OK, other than what scripts/checkpatch.pl will say and the added
whitespace, but:


> Signed-off-by: Jean-Christophe Dubois <[EMAIL PROTECTED]>
> ---
> 
> diff -ruN linux-source-2.6.24/drivers/net/usb/rndis_host.c 
> linux-source-2.6.24.new/drivers/net/usb/rndis_host.c
> --- linux-source-2.6.24/drivers/net/usb/rndis_host.c  2008-01-24 
> 11:52:31.000000000 +0100
> +++ linux-source-2.6.24.new/drivers/net/usb/rndis_host.c      2008-02-11 
> 17:43:48.000000000 +0100
> @@ -499,8 +499,18 @@
>       net->hard_header_len += sizeof (struct rndis_data_hdr);
>       dev->hard_mtu = net->mtu + net->hard_header_len;
>  
> +     /* now we need to compute dev->maxpacket */
> +     dev->maxpacket = usb_maxpacket (dev->udev, dev->out, 1);
> +
> +     if (dev->maxpacket == 0) {
> +             dev_err(&intf->dev, "dev->maxpacket can't be 0\n");
> +             retval = -EINVAL;
> +             goto fail_and_release;
> +     }

Why is this "if (dev->maxpacket == 0)" test needed?

It looks like pure paranoia.  If it's possible, the
bug would be someplace else.  Specifically, an endpoint
descriptor with an invalid maxpacket field ... something
that, if we check for it, should be tested in usbcore
as part of descriptor parsing, not special cased in
this driver.


> +
>       dev->rx_urb_size = dev->hard_mtu + (dev->maxpacket + 1);
>       dev->rx_urb_size &= ~(dev->maxpacket - 1);
> +
>       u.init->max_transfer_size = cpu_to_le32(dev->rx_urb_size);
>  
>       net->change_mtu = NULL;
> 


-
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to