From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: [9fans] usb/kb parsing uninitialized memory
Date: Fri, 28 Mar 2014 11:32:16 -0400 [thread overview]
Message-ID: <ab8e52c988f8503fa5f5c653f20ff09d@brasstown.quanstro.net> (raw)
i found this playing with one of those usb hid panels.
just tested with the busted apple 2005 keyboard and the newer
flat apple keyboard. both worked. (the 2005 keyboard doesn't
work on some h/w still due to the hub controller.)
i'm going to roll this into 9atom today. unfortunately, since
there is a pending change to usb/kb, i'll have to delay on submitting
this to sources.
/n/dump/2014/0328/sys/src/cmd/usb/kb/kb.c:762,768 - kb.c:762,767
d->free = freekdev;
kd->in = in;
kd->dev = d;
- res = -1;
kd->ep = openep(d, ep->id);
if(kd->ep == nil){
fprint(2, "kb: %s: workep: openep %d: %r\n", d->dir, ep->id);
/n/dump/2014/0328/sys/src/cmd/usb/kb/kb.c:782,791 - kb.c:781,792
kd->idle = Dwcidle;
}
}
- if(!kd->bootp)
- res= setfirstconfig(kd, ep->id, desc, sizeof desc);
- if(res > 0)
- res = parsereportdesc(&kd->templ, desc, sizeof desc);
+ res = -1;
+ if(!kd->bootp){
+ n = setfirstconfig(kd, ep->id, desc, sizeof desc);
+ if(n > 0)
+ res = parsereportdesc(&kd->templ, desc, n);
+ }
/* if we could not set the first config, we give up */
if(kd->bootp || res < 0){
kd->bootp = 1;
- erik
reply other threads:[~2014-03-28 15:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ab8e52c988f8503fa5f5c653f20ff09d@brasstown.quanstro.net \
--to=quanstro@quanstro.net \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).