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

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

 



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?

 > >  {
 > >          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.


 > >          name = udev->dev.driver->name;
 > >          info = (struct driver_info *) prod->driver_info;
 > >          if (!info) {
 > > @@ -1283,7 +1286,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
 > >          status = -ENOMEM;
 > >  
 > >          // set up our own records
 > > -        net = alloc_etherdev(sizeof(*dev));
 > > +        net = alloc_etherdev(pvtsize);
 > >          if (!net) {
 > >                  dbg ("can't kmalloc dev");
 > >                  goto out;
 > > @@ -1409,6 +1412,13 @@ out:
 > >          usb_put_dev(xdev);
 > >          return status;
 > >  }
 > > +EXPORT_SYMBOL_GPL(usbnet_probe_pvtsize);
 > > +
 > > +int
 > > +usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)

 > Same coding style issue.  Please run your patches through
 > scripts/checkpatch.pl before sending them out.

I did, sure, it was a dilemma.

-- 
WBR, Yauheni Kaliuta
--
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