dev->config = kmalloc(length, GFP_KERNEL); 
dev->config = kzalloc(length, GFP_KERNEL); 
int usb_get_configuration(struct usb_device *dev){	struct device *ddev = &dev->dev;	int ncfg = dev->descriptor.bNumConfigurations;	int result = -ENOMEM;	unsigned int cfgno, length;	unsigned char *buffer;	unsigned char *bigbuffer; 	struct usb_config_descriptor *desc;	if (ncfg > USB_MAXCONFIG) {		dev_warn(ddev, "too many configurations: %d, "		    "using maximum allowed: %d\n", ncfg, USB_MAXCONFIG);		dev->descriptor.bNumConfigurations = ncfg = USB_MAXCONFIG;	}	if (ncfg < 1) {		dev_err(ddev, "no configurations\n");		return -EINVAL;	}	length = ncfg * sizeof(struct usb_host_config);	dev->config = kmalloc(length, GFP_KERNEL);	if (!dev->config)		goto err2;	memset(dev->config, 0, length);	length = ncfg * sizeof(char *);	dev->rawdescriptors = kmalloc(length, GFP_KERNEL);	if (!dev->rawdescriptors)		goto err2;	memset(dev->rawdescriptors, 0, length);	buffer = kmalloc(USB_DT_CONFIG_SIZE, GFP_KERNEL);	if (!buffer)		goto err2;	desc = (struct usb_config_descriptor *)buffer;	for (cfgno = 0; cfgno < ncfg; cfgno++) {		/* We grab just the first descriptor so we know how long		 * the whole configuration is */		result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno,		    buffer, USB_DT_CONFIG_SIZE);		if (result < 0) {			dev_err(ddev, "unable to read config index %d "			    "descriptor/%s\n", cfgno, "start");			goto err;		} else if (result < 4) {			dev_err(ddev, "config index %d descriptor too short "			    "(expected %i, got %i)\n", cfgno,			    USB_DT_CONFIG_SIZE, result);			result = -EINVAL;			goto err;		}		length = max((int) le16_to_cpu(desc->wTotalLength),		    USB_DT_CONFIG_SIZE);		/* Now that we know the length, get the whole thing */		bigbuffer = kmalloc(length, GFP_KERNEL);		if (!bigbuffer) {			result = -ENOMEM;			goto err;		}		result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno,		    bigbuffer, length);		if (result < 0) {			dev_err(ddev, "unable to read config index %d "			    "descriptor/%s\n", cfgno, "all");			kfree(bigbuffer);			goto err;		}		if (result < length) {			dev_warn(ddev, "config index %d descriptor too short "			    "(expected %i, got %i)\n", cfgno, length, result);			length = result;		}		dev->rawdescriptors[cfgno] = bigbuffer;		result = usb_parse_configuration(&dev->dev, cfgno,		    &dev->config[cfgno], bigbuffer, length);		if (result < 0) {			++cfgno;			goto err;		}	}	result = 0;err:	kfree(buffer);	dev->descriptor.bNumConfigurations = cfgno;err2:	if (result == -ENOMEM)		dev_err(ddev, "out of memory\n");	return result;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/0a1ef3b5a765a6f20e7b8caf295aad3276243966/config.c/buggy/drivers/usb/core/config.c