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

Re: [MiNT] [PATCH] Make memory allocation for device and configuration descriptors dynamic



2014-10-05 21:24 GMT+02:00 Alan Hourihane <alanh@fairlite.co.uk>:
> On 05/10/14 19:34, David Gálvez wrote:
>> Hi,
>>
>> I have seen some device with configuration descriptor bigger than 512
>> bytes (size of static buffer in our USB stack), so I've made buffers
>> memory allocation for device and configuration descriptors dynamic.
>>
>> ----------------------------------
>>
>> Commit message:
>>
>> Make buffers memory allocation for device and configuration descriptors dynamic.
> David,
>
> This doesn't look right.
>
> usb_get_configuration_no() is being passed tmpbuf which is the device
> descriptor just been retrieved from usb_get_descriptor(), but now you
> are mallocing a 9 byte buffer and won't contain that information.
>

Sorry, I knew a should have removed this argument from the function
usb_get_configuration_no() but I forgot to do it.
Thanks for correcting the patch.

> What was the size of the configuration descriptor you saw ?
>

1183 bytes

> Also can we check what Linux does here ?
>

Linux allocates it dynamically.

I've also forgotten to check the return values from kmalloc. I send a
new mail with a patch with those checks.