* Fwd: divide error: 0000 in the gspca_topro [not found] <54D7E0B8.30503@reflexion.tv> @ 2015-02-09 2:07 ` Linus Torvalds 2015-02-09 10:23 ` Luis de Bethencourt 0 siblings, 1 reply; 5+ messages in thread From: Linus Torvalds @ 2015-02-09 2:07 UTC (permalink / raw) To: Hans de Goede, Mauro Carvalho Chehab; +Cc: Linux Media Mailing List I got this, and it certainly seems relevant,. It would seem that that whole 'quality' thing needs some range checking, it should presumably be in the range [1..100] in order to avoid negative 'sc' values or the divide-by-zero. Hans, Mauro? Linus ---------- Forwarded message ---------- From: Peter Kovář <peter.kovar@reflexion.tv> Date: Sun, Feb 8, 2015 at 2:18 PM Subject: divide error: 0000 in the gspca_topro To: Linus Torvalds <torvalds@linux-foundation.org> Hi++ Linus! There is a trivial bug in the gspca_topro webcam driver. /* set the JPEG quality for sensor soi763a */ static void jpeg_set_qual(u8 *jpeg_hdr, int quality) { int i, sc; if (quality < 50) sc = 5000 / quality; else sc = 200 - quality * 2; Crash can be reproduced by setting JPEG quality to zero in the guvcview application. Cheers, Peter Kovář 50 65 74 65 72 20 4B 6F 76 C3 A1 C5 99 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Fwd: divide error: 0000 in the gspca_topro 2015-02-09 2:07 ` Fwd: divide error: 0000 in the gspca_topro Linus Torvalds @ 2015-02-09 10:23 ` Luis de Bethencourt 2015-02-09 15:56 ` Mauro Carvalho Chehab 0 siblings, 1 reply; 5+ messages in thread From: Luis de Bethencourt @ 2015-02-09 10:23 UTC (permalink / raw) To: Linus Torvalds Cc: Hans de Goede, Mauro Carvalho Chehab, Linux Media Mailing List On Sun, Feb 08, 2015 at 06:07:45PM -0800, Linus Torvalds wrote: > I got this, and it certainly seems relevant,. > > It would seem that that whole 'quality' thing needs some range > checking, it should presumably be in the range [1..100] in order to > avoid negative 'sc' values or the divide-by-zero. > > Hans, Mauro? > > Linus Hello Linus, The case of quality being set to 0 is correctly handled in drivers/media/usb/gspca/jpeg.h [0], so I have sent a patch to do the same in topro.c. Thanks, Luis [0] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/media/usb/gspca/jpeg.h#n157 > > ---------- Forwarded message ---------- > From: Peter Kovář <peter.kovar@reflexion.tv> > Date: Sun, Feb 8, 2015 at 2:18 PM > Subject: divide error: 0000 in the gspca_topro > To: Linus Torvalds <torvalds@linux-foundation.org> > > > Hi++ Linus! > > There is a trivial bug in the gspca_topro webcam driver. > > /* set the JPEG quality for sensor soi763a */ > static void jpeg_set_qual(u8 *jpeg_hdr, > int quality) > { > int i, sc; > > if (quality < 50) > sc = 5000 / quality; > else > sc = 200 - quality * 2; > > > > Crash can be reproduced by setting JPEG quality to zero in the guvcview > application. > > Cheers, > > Peter Kovář > 50 65 74 65 72 20 4B 6F 76 C3 A1 C5 99 > -- > To unsubscribe from this list: send the line "unsubscribe linux-media" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: divide error: 0000 in the gspca_topro 2015-02-09 10:23 ` Luis de Bethencourt @ 2015-02-09 15:56 ` Mauro Carvalho Chehab 2015-02-09 16:06 ` Luis de Bethencourt 2015-02-10 8:28 ` Hans de Goede 0 siblings, 2 replies; 5+ messages in thread From: Mauro Carvalho Chehab @ 2015-02-09 15:56 UTC (permalink / raw) To: Luis de Bethencourt Cc: Linus Torvalds, Hans de Goede, Linux Media Mailing List Em Mon, 09 Feb 2015 10:23:48 +0000 Luis de Bethencourt <luis@debethencourt.com> escreveu: > On Sun, Feb 08, 2015 at 06:07:45PM -0800, Linus Torvalds wrote: > > I got this, and it certainly seems relevant,. > > > > It would seem that that whole 'quality' thing needs some range > > checking, it should presumably be in the range [1..100] in order to > > avoid negative 'sc' values or the divide-by-zero. > > > > Hans, Mauro? > > > > Linus > > Hello Linus, > > The case of quality being set to 0 is correctly handled in > drivers/media/usb/gspca/jpeg.h [0], so I have sent a patch to do the same > in topro.c. Patch looks good to me. I'll double check if some other driver has the same bad handling for quality set and give a couple days for Hans to take a look. If he's fine with this approach, I'll add it on a separate pull request. Regards, Mauro > > Thanks, > Luis > > [0] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/media/usb/gspca/jpeg.h#n157 > > > > > ---------- Forwarded message ---------- > > From: Peter Kovář <peter.kovar@reflexion.tv> > > Date: Sun, Feb 8, 2015 at 2:18 PM > > Subject: divide error: 0000 in the gspca_topro > > To: Linus Torvalds <torvalds@linux-foundation.org> > > > > > > Hi++ Linus! > > > > There is a trivial bug in the gspca_topro webcam driver. > > > > /* set the JPEG quality for sensor soi763a */ > > static void jpeg_set_qual(u8 *jpeg_hdr, > > int quality) > > { > > int i, sc; > > > > if (quality < 50) > > sc = 5000 / quality; > > else > > sc = 200 - quality * 2; > > > > > > > > Crash can be reproduced by setting JPEG quality to zero in the guvcview > > application. > > > > Cheers, > > > > Peter Kovář > > 50 65 74 65 72 20 4B 6F 76 C3 A1 C5 99 > > -- > > To unsubscribe from this list: send the line "unsubscribe linux-media" in > > the body of a message to majordomo@vger.kernel.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: divide error: 0000 in the gspca_topro 2015-02-09 15:56 ` Mauro Carvalho Chehab @ 2015-02-09 16:06 ` Luis de Bethencourt 2015-02-10 8:28 ` Hans de Goede 1 sibling, 0 replies; 5+ messages in thread From: Luis de Bethencourt @ 2015-02-09 16:06 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Linus Torvalds, Hans de Goede, Linux Media Mailing List On Mon, Feb 09, 2015 at 01:56:56PM -0200, Mauro Carvalho Chehab wrote: > Em Mon, 09 Feb 2015 10:23:48 +0000 > Luis de Bethencourt <luis@debethencourt.com> escreveu: > > > On Sun, Feb 08, 2015 at 06:07:45PM -0800, Linus Torvalds wrote: > > > I got this, and it certainly seems relevant,. > > > > > > It would seem that that whole 'quality' thing needs some range > > > checking, it should presumably be in the range [1..100] in order to > > > avoid negative 'sc' values or the divide-by-zero. > > > > > > Hans, Mauro? > > > > > > Linus > > > > Hello Linus, > > > > The case of quality being set to 0 is correctly handled in > > drivers/media/usb/gspca/jpeg.h [0], so I have sent a patch to do the same > > in topro.c. > > Patch looks good to me. > > I'll double check if some other driver has the same bad handling for > quality set and give a couple days for Hans to take a look. > > If he's fine with this approach, I'll add it on a separate pull request. > > Regards, > Mauro > Hi Mauro, Thanks for taking the time to look at this. After sending the patch I searched around for any similar cases, only finding coda/coda-jpeg.c [0], but in this case the quality is clipped to 5 if it is < 5. I might have missed some other case though. Just letting you know to help you save some time. Cheers, Luis [0] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/media/platform/coda/coda-jpeg.c#n216 > > > > Thanks, > > Luis > > > > [0] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/media/usb/gspca/jpeg.h#n157 > > > > > > > > ---------- Forwarded message ---------- > > > From: Peter Kovář <peter.kovar@reflexion.tv> > > > Date: Sun, Feb 8, 2015 at 2:18 PM > > > Subject: divide error: 0000 in the gspca_topro > > > To: Linus Torvalds <torvalds@linux-foundation.org> > > > > > > > > > Hi++ Linus! > > > > > > There is a trivial bug in the gspca_topro webcam driver. > > > > > > /* set the JPEG quality for sensor soi763a */ > > > static void jpeg_set_qual(u8 *jpeg_hdr, > > > int quality) > > > { > > > int i, sc; > > > > > > if (quality < 50) > > > sc = 5000 / quality; > > > else > > > sc = 200 - quality * 2; > > > > > > > > > > > > Crash can be reproduced by setting JPEG quality to zero in the guvcview > > > application. > > > > > > Cheers, > > > > > > Peter Kovář > > > 50 65 74 65 72 20 4B 6F 76 C3 A1 C5 99 > > > -- > > > To unsubscribe from this list: send the line "unsubscribe linux-media" in > > > the body of a message to majordomo@vger.kernel.org > > > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: divide error: 0000 in the gspca_topro 2015-02-09 15:56 ` Mauro Carvalho Chehab 2015-02-09 16:06 ` Luis de Bethencourt @ 2015-02-10 8:28 ` Hans de Goede 1 sibling, 0 replies; 5+ messages in thread From: Hans de Goede @ 2015-02-10 8:28 UTC (permalink / raw) To: Mauro Carvalho Chehab, Luis de Bethencourt Cc: Linus Torvalds, Linux Media Mailing List Hi, On 09-02-15 16:56, Mauro Carvalho Chehab wrote: > Em Mon, 09 Feb 2015 10:23:48 +0000 > Luis de Bethencourt <luis@debethencourt.com> escreveu: > >> On Sun, Feb 08, 2015 at 06:07:45PM -0800, Linus Torvalds wrote: >>> I got this, and it certainly seems relevant,. >>> >>> It would seem that that whole 'quality' thing needs some range >>> checking, it should presumably be in the range [1..100] in order to >>> avoid negative 'sc' values or the divide-by-zero. >>> >>> Hans, Mauro? >>> >>> Linus >> >> Hello Linus, >> >> The case of quality being set to 0 is correctly handled in >> drivers/media/usb/gspca/jpeg.h [0], so I have sent a patch to do the same >> in topro.c. > > Patch looks good to me. > > I'll double check if some other driver has the same bad handling for > quality set and give a couple days for Hans to take a look. > > If he's fine with this approach, I'll add it on a separate pull request. Luis' patch for this looks good to me and is: Acked-by: Hans de Goede <hdegoede@redhat.com> Mauro, thanks for picking this one up. Regards, Hans ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-02-10 8:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <54D7E0B8.30503@reflexion.tv>
2015-02-09 2:07 ` Fwd: divide error: 0000 in the gspca_topro Linus Torvalds
2015-02-09 10:23 ` Luis de Bethencourt
2015-02-09 15:56 ` Mauro Carvalho Chehab
2015-02-09 16:06 ` Luis de Bethencourt
2015-02-10 8:28 ` Hans de Goede
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.