[U-Boot] [PATCH v2] usb: Use well-known descriptor sizes when parsing configuration

Marek Vasut marex at denx.de
Sun Jul 21 04:32:36 CEST 2013


Hi Julius,

> > How would that make the code more consistent ? It seems if the device can
> > not even provide valid config ep descriptor, the device is broken beyond
> > salvation.
> 
> Okay, sure, it's not important enough to argue about. Will resubmit it this
> way.
> 
> >> The sizeof() thing is true for the configuration descriptor, but not
> >> for some others (e.g. endpoint) because U-Boot reserves fields for
> >> it's own stuff behind that.
> > 
> > Urgh, then the structure defining the descriptor shall be separated out.
> 
> Yes, maybe. But let's please not blow this patch up any more than it
> already is.
> 
> >> > Would be nice to clean this up into "understandable" format by
> >> > defining a variable for the &buffer[index] and than just simply
> >> > comparing this var-
> >> > 
> >> >>bInterfaceNumber and curr_if_num .
> >> 
> >> Agreed, but let's clean this up one patch at a time.
> > 
> > Would you do a series on this maybe?
> 
> On second thought, we already have the variable head (respectively
> head->bLength) to point there... I can just use that instead.
> 
> > So, let's just ignore broken descriptors.
> 
> Done.
> 
> > Document this properly then.
> 
> I'm already adding a comment to usb_parse_config() to point that
> out... I'll clarify that this includes sanitization in addition to
> byte swapping.

THanks a lot! I'm glad you're cleaning this horror up.

Best regards,
Marek Vasut


More information about the U-Boot mailing list