Re: [RFC/PATCH 3/8] usb: usbnet: introduce usbnet_probe_pvtsize()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 08, 2010 at 11:17:17AM +0300, Yauheni Kaliuta wrote:
> 
> Hi!
> 
> >>>>> "eGK" == ext Greg KH writes:
> 
>  >  On Wed, Apr 07, 2010 at 08:40:55PM +0300, yauheni.kaliuta@xxxxxxxxx wrote:
>  > > From: Yauheni Kaliuta <yauheni.kaliuta@xxxxxxxxx>
>  > > 
>  > > Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@xxxxxxxxx>
>  > > ---
>  > >  drivers/net/usb/usbnet.c   |   14 ++++++++++++--
>  > >  include/linux/usb/usbnet.h |    2 ++
>  > >  2 files changed, 14 insertions(+), 2 deletions(-)
>  > > 
>  > > diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
>  > > index 17b6a62..bba5b6e 100644
>  > > --- a/drivers/net/usb/usbnet.c
>  > > +++ b/drivers/net/usb/usbnet.c
>  > > @@ -1259,7 +1259,8 @@ static struct device_type wwan_type = {
>  > >  };
>  > >  
>  > >  int
>  > > -usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
>  > > +usbnet_probe_pvtsize (struct usb_interface *udev,
>  > > +                      const struct usb_device_id *prod, size_t pvtsize)
> 
>  > No need to keep adding coding style violations :)
> 
> Well, I did not want to break the existing style. Is it ok, if there will
> be usbnet.c cleanup patch before?

No, just don't add new violations, you can fix them up as you change the
code, leave the old stuff alone.

>  > >  {
>  > >          struct usbnet                        *dev;
>  > >          struct net_device                *net;
>  > > @@ -1269,6 +1270,8 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
>  > >          int                                status;
>  > >          const char                        *name;
>  > >  
>  > > +        BUG_ON(pvtsize < sizeof(*dev));
>  > > +
> 
>  > Hm, why kill the whole machine here?  That seems harsh.  Isn't this a
>  > build-time issue?  Or is it ever something that is realistic to hit?  If
>  > so, can't you properly handle it?
> 
> well, it's a bug for sure, but may be it's reasonable to fail the probe and
> print a warning, ok.

Yes, again, you _never_ want to crash a machine for something like this,
right?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux