On 28/06/13(Fri) 13:08, joshua stein wrote: > On Fri, 28 Jun 2013 at 12:14:43 -0400, David Hill wrote: > > in pms_proc_mouse, wsmouse_input is called with an uninitialized > > 'dz' variable if the sc->protocol->type is not PMS_STANDARD or > > PMS_INTELLI. > > It should probably just return and not call wsmouse_input if the > protocol type is unknown.
The protocol type cannot be unknown. pms_proc_mouse() is only called through sc->protocol->proc() and in this case "type" is always defined to either PMS_STANDARD or PMS_INTELLI. So this change only makes the code harder to understand as it suggests there's more than two protocols supported by this function. > > Index: pms.c > > =================================================================== > > RCS file: /cvs/src/sys/dev/pckbc/pms.c,v > > retrieving revision 1.43 > > diff -u -p -r1.43 pms.c > > --- pms.c 31 May 2013 19:21:09 -0000 1.43 > > +++ pms.c 28 Jun 2013 16:13:02 -0000 > > @@ -595,7 +595,7 @@ void > > pms_proc_mouse(struct pms_softc *sc) > > { > > u_int buttons; > > - int dx, dy, dz; > > + int dx, dy, dz; > > > > buttons = butmap[sc->packet[0] & PMS_PS2_BUTTONSMASK]; > > dx = (sc->packet[0] & PMS_PS2_XNEG) ? > > @@ -604,11 +604,12 @@ pms_proc_mouse(struct pms_softc *sc) > > (int)sc->packet[2] - 256 : sc->packet[2]; > > > > switch (sc->protocol->type) { > > - case PMS_STANDARD: > > - dz = 0; > > - break; > > case PMS_INTELLI: > > dz = (signed char)sc->packet[3]; > > + break; > > + case PMS_STANDARD: > > + default: > > + dz = 0; > > break; > > } > > > > >