linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: "Pali Rohár" <pali.rohar@gmail.com>
Cc: Peter Teoh <htmldeveloper@gmail.com>,
	Tomi Valkeinen <tomi.valkeinen@ti.com>,
	Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
	Jyri Sarha <jsarha@ti.com>, omap <linux-omap@vger.kernel.org>,
	linux-fbdev@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	Sebastian Reichel <sre@kernel.org>,
	Aaro Koskinen <aaro.koskinen@iki.fi>,
	Tony Lindgren <tony@atomide.com>, Nishanth Menon <nm@ti.com>
Subject: Re: omapdss: Division by zero in kernel
Date: Thu, 17 Sep 2015 05:16:44 +0000	[thread overview]
Message-ID: <20150917051644.GA6665@amd> (raw)
In-Reply-To: <20150819081139.GB15712@pali>


> >         if (image->depth = 1) {
> >                 if (p->fix.visual = FB_VISUAL_TRUECOLOR ||
> >                     p->fix.visual = FB_VISUAL_DIRECTCOLOR) {
> >                         fgcolor = ((u32*)(p->pseudo_palette))[image->fg_color];
> >                         bgcolor = ((u32*)(p->pseudo_palette))[image->bg_color];
> >                 } else {
> >                         fgcolor = image->fg_color;
> >                         bgcolor = image->bg_color;
> >                 }
> > 
> >                 if (32 % bpp = 0 && !start_index && !pitch_index &&
> >                     ((width & (32/bpp-1)) = 0) &&
> >                     bpp >= 8 && bpp <= 32)
> >                         fast_imageblit(image, p, dst1, fgcolor, bgcolor);
> >                 else
> >                         slow_imageblit(image, p, dst1, fgcolor, bgcolor,
> >                                         start_index, pitch_index);
> >         } else
> >                 color_imageblit(image, p, dst1, start_index, pitch_i
> > 
> > 
> > Notice that bpp is not checked for zero, and thus bpp=0 is totally
> > feasible?   resulting in 32/bpp crashing the kernel?
> > 
> 
> Hm... this could really be a problem! But how to patch it? Which branch
> should be called (fast_ or slow_ function) if bpp is zero?
> 
> And is there some way to force kernel to dump backtrace into dmesg when
> division by zero occur?

You can do WARN_ON(bpp=1) ... and should probably return in that
case.

								Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  reply	other threads:[~2015-09-17  5:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-24 16:03 omapdss: Division by zero in kernel Pali Rohár
2015-07-28 11:56 ` Pali Rohár
2015-08-18 14:00   ` Pali Rohár
2015-08-18 14:11 ` Peter Teoh
2015-08-19  8:11   ` Pali Rohár
2015-09-17  5:16     ` Pavel Machek [this message]
2015-09-25 11:34       ` Pali Rohár
2015-08-21  8:42 ` Tomi Valkeinen
2015-08-21  8:48   ` Pali Rohár
2015-08-21  9:17     ` Tomi Valkeinen
2015-08-26 10:16       ` Pali Rohár

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=20150917051644.GA6665@amd \
    --to=pavel@ucw.cz \
    --cc=aaro.koskinen@iki.fi \
    --cc=htmldeveloper@gmail.com \
    --cc=jsarha@ti.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=pali.rohar@gmail.com \
    --cc=plagnioj@jcrosoft.com \
    --cc=sre@kernel.org \
    --cc=tomi.valkeinen@ti.com \
    --cc=tony@atomide.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).