[U-Boot] [PATCH] usb: dwc3: fixes crash in dwc3 driver due to types size mismatch

Marek Vasut marex at denx.de
Thu Jul 21 14:35:17 CEST 2016


On 07/21/2016 02:29 PM, B, Ravi wrote:
> Hi Marek
> 
>>> The crash at dwc3 driver observed due to offset misalignment of 
>>> structure members across files causing wrong code generation and leads 
>>> to crash, the issue is found during dfu test.
>>>
>>> For instance, ther is is mismatch in code generation to access the 
>>> address of structure member dwc->dep[0] in gadget.c and ep0.c. This 
>>> leads to NULL pointer reference casuing the crash. The inclusion of 
>>> common.h fixes the issue.
> 
>> Please explain why this patch fixes the issue.
> 
> Ok I will explain, due to the commit[1] the resource_size_t size has increased to 8 bytes (64 bit), compared to earlier 32 bit (4bytes) and the definition is moved to includes/linux/types.h from asm.h. Due to this change the code generated in gadget.c is correct, due to inclusion of right header file (common.h, which includes linux/types.h). Whereas, the ep0.c does not includes common.h, hence  size of resources_size_t is 4 bytes, causing wrong offset code generated for structure members which includes resource_size_t, which leads to pointing to wrong offset location causing the crash.

This stuff should be in the commit message. Still, git grep
resource_size_t does not show that it's used in gadget.c , so
I don't understand how this patch can fix things.

Also, please fix your mailer to break at 80 chars per line.

>> Make the explanation terse, it took me quite a while to extrapolate the message from the text.
> 
>>> The crash occurs due to below commit[1], revert of this patch resolves 
>>> the issue.
>>>
>>> [1] commit 95ebc253e6d4a3370e3dab14743bfc99fcd9cf1b
>>> Author: Masahiro Yamada <yamada.masahiro at socionext.com>
>>> Date:   Tue Jun 28 10:48:40 2016 +0900
>>>
>>> types.h: move and redefine resource_size_t
> 
>> No need to include the whole commit message of another commit, just the subject is enough. Also, I dunno why you add two levels of indent to the headers of the commit, but not to the subject, this is real confusing.
> 
> My bad, sorry for causing confusion. 
> 
> Regards
> Ravi 
> 


-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list