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

B, Ravi ravibabu at ti.com
Thu Jul 21 14:44:31 CEST 2016


Hi Marek
 
>>> 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.

Thanks, I will add this text to commit message. The resource_size_t is used in dwc3 structure
defined in drivers/usb/dwc3/core.h

struct dwc3 {
	....
	struct resource  xhci_resource[DWC3_XHCI_RESOURCES_NUM];
	..
};
The resource structure defined in include/linux/ioport.h 
struct resource {
	resource_size_t start;
	resource_size_t end;
}

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

Sure.

Regards
Ravi


More information about the U-Boot mailing list