On Tue, Jan 20, 2004 at 04:09:27PM -0800, Greg KH wrote:
> On Tue, Jan 20, 2004 at 06:52:40PM +0100, Dimitri Torfs wrote:
> > The first one I encountered is in the usb_new_device() function in usb.c
> > where the first 8 bytes of the descriptor are fetched:
> > 
> >   err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, &dev->descriptor, 8);
> 
> But isn't that data (descriptor) created with a call to kmalloc()?  As
> long as it isn't on the stack it should be ok, correct?

The struct usb_device is created with a call to kmalloc, and the
descriptor is just part of the struct usb_device (so one might say
that the descriptor data is coming out of a kmalloc'ed buffer, but I
would not call it "created with a call to kmalloc"). Kmalloc'ed
buffers (i.e. the return value of kmalloc) are cacheline-aligned, but
from the moment you start (randomly) dereferencing something within the buffer
you lose the cacheline-alignment. 


Dimitri

-- 
Dimitri Torfs       |  NSCE 
[EMAIL PROTECTED] |  The Corporate Village
tel: +32 2 7008541  |  Da Vincilaan 7 - D1 
fax: +32 2 7008622  |  B-1935 Zaventem - Belgium



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to