On 11/12/14(Thu) 12:48, Mark Kettenis wrote: > > Date: Thu, 11 Dec 2014 12:22:56 +0100 > > From: Martin Pieuchot <[email protected]> > > > > Index: ucycom.c > > =================================================================== > > RCS file: /home/ncvs/src/sys/dev/usb/ucycom.c,v > > retrieving revision 1.29 > > diff -u -p -r1.29 ucycom.c > > --- ucycom.c 12 Jul 2014 20:26:33 -0000 1.29 > > +++ ucycom.c 11 Dec 2014 09:50:14 -0000 > > @@ -453,13 +453,9 @@ ucycom_param(void *addr, int portno, str > > report[2] = (baud >> 16) & 0xff; > > report[3] = (baud >> 24) & 0xff; > > report[4] = cfg; > > - err = uhidev_set_report(&sc->sc_hdev, UHID_FEATURE_REPORT, > > - sc->sc_hdev.sc_report_id, report, sc->sc_flen); > > - if (err != 0) { > > - DPRINTF(("ucycom_param: uhidev_set_report %d %s\n", > > - err, usbd_errstr(err))); > > + if (uhidev_set_report(sc->sc_hdev.sc_parent, UHID_FEATURE_REPORT, > > + sc->sc_hdev.sc_report_id, report, sc->sc_flen) != sc->sc_flen) > > return EIO; > > - } > > sc->sc_baud = baud; > > return (err); > > } > > @@ -553,10 +549,10 @@ ucycom_set(void *addr, int portno, int r > > void > > ucycom_get_cfg(struct ucycom_softc *sc) > > { > > - int err, cfg, baud; > > + int cfg, baud; > > uint8_t report[5]; > > > > - err = uhidev_get_report(&sc->sc_hdev, UHID_FEATURE_REPORT, > > + uhidev_get_report(sc->sc_hdev.sc_parent, UHID_FEATURE_REPORT, > > sc->sc_hdev.sc_report_id, report, sc->sc_flen); > > cfg = report[4]; > > baud = (report[3] << 24) + (report[2] << 16) + (report[1] << 8) + > > report[0]; > > Doesn't this mean that if you get a "short" reply, you'll be looking > at stack garbage? Don't think that is a good idea...
I agree. But that is already the case... well sort of because this functions is never called. I'll fix that :)
