From: Luis de Bethencourt <luis@debethencourt.com>
To: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Hans de Goede <hdegoede@redhat.com>,
Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: Re: divide error: 0000 in the gspca_topro
Date: Mon, 9 Feb 2015 16:06:30 +0000 [thread overview]
Message-ID: <20150209160630.GA5332@biggie> (raw)
In-Reply-To: <20150209135656.11cc85e6@recife.lan>
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
next prev parent reply other threads:[~2015-02-09 16:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[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 [this message]
2015-02-10 8:28 ` Hans de Goede
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=20150209160630.GA5332@biggie \
--to=luis@debethencourt.com \
--cc=hdegoede@redhat.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@osg.samsung.com \
--cc=torvalds@linux-foundation.org \
/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 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.