From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfgang Denk Date: Mon, 07 Apr 2014 18:59:16 +0200 Subject: [U-Boot] [PATCH] Fix USB keyboard polling via control endpoint In-Reply-To: <3392231.3254.1396864604431.JavaMail.adrian@Gurnard> References: <3392231.3254.1396864604431.JavaMail.adrian@Gurnard> Message-ID: <20140407165916.C315B380958@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Adrian, In message <3392231.3254.1396864604431.JavaMail.adrian@Gurnard> you wrote: > > > From: "Wolfgang Denk" > > > 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 -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de In accord with UNIX philosophy, Perl gives you enough rope to hang yourself. - L. Wall & R. L. Schwartz, _Programming Perl_