On 16/06/12(Sat) 21:16, Gregor Best wrote: > Hi people, > > the attached patch fixes a little bug in uvideo(4), where using > VIDIOC_ENUM_FMT > with fmtdesc->index strictly larger than the number of available video formats > crashes the kernel (I forgot the exact error message, but a crash is a crash > and > the attached patch fixes it).
Thanks. Out of curiosity with which application did you find this? > > -- > Gregor Best > Index: dev/usb/uvideo.c > =================================================================== > RCS file: /cvs/src/sys/dev/usb/uvideo.c,v > retrieving revision 1.166 > diff -u -p -r1.166 uvideo.c > --- dev/usb/uvideo.c 28 Oct 2011 12:48:31 -0000 1.166 > +++ dev/usb/uvideo.c 16 Jun 2012 19:15:58 -0000 > @@ -2775,7 +2775,7 @@ uvideo_enum_fmt(void *v, struct v4l2_fmt > /* type not supported */ > return (EINVAL); > > - if (fmtdesc->index == sc->sc_fmtgrp_num) > + if (fmtdesc->index >= sc->sc_fmtgrp_num) > /* no more formats left */ > return (EINVAL); > idx = fmtdesc->index;