From duncan.sands@math.u-psud.fr Sat May 28 13:15:24 2005 Subject: USB: usbatm kcalloc cleanup From: Duncan Sands To: gregkh@suse.de Cc: greg@kroah.com, zaitcev@redhat.com Date: Sat, 28 May 2005 22:06:20 +0200 Message-Id: <1117310781.9573.9.camel@localhost.localdomain> you seem to have applied the original, not the new improved one with whiter teeth that uses kcalloc instead of kmalloc + memset. Here's a patch that goes on top of the one you applied. Signed-off-by: Duncan Sands Signed-off-by: Greg Kroah-Hartman --- drivers/usb/atm/usbatm.c | 5 +---- 1 files changed, 1 insertion(+), 4 deletions(-) --- gregkh-2.6.orig/drivers/usb/atm/usbatm.c 2005-06-01 17:13:53.000000000 -0700 +++ gregkh-2.6/drivers/usb/atm/usbatm.c 2005-06-01 22:31:41.000000000 -0700 @@ -949,7 +949,6 @@ struct usb_device *usb_dev = interface_to_usbdev(intf); struct usbatm_data *instance; char *buf; - size_t instance_size = sizeof(*instance) + sizeof(struct urb *) * (num_rcv_urbs + num_snd_urbs); int error = -ENOMEM; int i, length; int need_heavy; @@ -961,14 +960,12 @@ intf->altsetting->desc.bInterfaceNumber); /* instance init */ - instance = kmalloc(instance_size, GFP_KERNEL); + instance = kcalloc(1, sizeof(*instance) + sizeof(struct urb *) * (num_rcv_urbs + num_snd_urbs), GFP_KERNEL); if (!instance) { dev_dbg(dev, "%s: no memory for instance data!\n", __func__); return -ENOMEM; } - memset(instance, 0, instance_size); - /* public fields */ instance->driver = driver;