
Dear Adrian,
In message 3392231.3254.1396864604431.JavaMail.adrian@Gurnard you wrote:
From: "Wolfgang Denk" wd@denx.de
I agree that the code is wrong and needs fixing. data->new is an uint8_t pointer, so taking the size of the pointer is obviously wrong. But what you fix here is not the only place where sizeof(data->new) is used, so this patch fixes part of the problem at best.
I can't find any other instances of sizeof in usb_kbd.c.
Yes, you are right. I did not see that your patch fixes both occurrences of sizeof(data->new).
Is this a broader problem in the USB stack?
I haven't looked at the other code, so I cannot comment on that.
Can you please try out if the following extended version f the patch works and fixes your problem? You will note that I removed all occurrences of this magic number 8 by replacing it with USB_KBD_PDATA_SIZE so the could should also be easier to read.
I've tested your extended patch, and it does fix the problem for me. I agree that adding USB_KBD_PDATA_SIZE does improve readability.
Thanks for testing.
Marek, can you then please use my version of the patch instead of the original one?
Thanks.
Best regards,
Wolfgang Denk