All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Antonino A. Daplas" <adaplas@gmail.com>
To: Tero Roponen <teanropo@jyu.fi>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Pekka Enberg <penberg@cs.helsinki.fi>,
	linux-kernel@vger.kernel.org, Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Andy Whitcroft <apw@shadowen.org>
Subject: Re: tty-related oops in latest kernel(s)?
Date: Thu, 31 May 2007 06:14:18 +0800	[thread overview]
Message-ID: <1180563258.4570.6.camel@daplas> (raw)
In-Reply-To: <Pine.LNX.4.64.0705301857370.29485@jalava.cc.jyu.fi>

[-- Attachment #1: Type: text/plain, Size: 951 bytes --]

On Wed, 2007-05-30 at 19:01 +0300, Tero Roponen wrote:
> On Wed, 30 May 2007, Andrew Morton wrote:
> 
> > On Wed, 30 May 2007 15:02:49 +0300 (EEST) Tero Roponen <teanropo@jyu.fi> wrote:
> > 
> > > On Wed, 30 May 2007, Pekka Enberg wrote:
> > > 
> > > > On 5/30/07, Tero Roponen <teanropo@jyu.fi> wrote:

> [root@terrop ~]# cat oops.c
> #include <sys/ioctl.h>
> #include <stdio.h>
> #include <linux/fb.h>
> #include <fcntl.h>
> 
> int main(void)
> {
>         struct fb_var_screeninfo fbinfo;
>         int fd = open("/dev/fb0", O_RDWR);
>         if (fd < 0)
>                 return 1;
> 
>         /* Get screeninfo */
>         ioctl(fd, FBIOGET_VSCREENINFO, &fbinfo);
> 
>         /* Change depth from current 16 to 24. */
>         fbinfo.bits_per_pixel = 24;
>         ioctl(fd, FBIOPUT_VSCREENINFO, &fbinfo);
> 
>         return 0;
> }
> 
> So this seems to be a framebuffer error.

It's a fb_setcolreg() bug in neofb.  Try this patch?

Tony



[-- Attachment #2: 18-neofb_array_overrun --]
[-- Type: text/plain, Size: 1630 bytes --]

neofb: Fix pseudo_palette array overrun in neofb_setcolreg

The pseudo_palette has room for 16 entries only, but in truecolor mode, it
attempts to add 256.

Signed-off-by: Antonino Daplas <adaplas@gmail.com>
---

 drivers/video/neofb.c |   30 ++++++++++++++++--------------
 1 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/video/neofb.c b/drivers/video/neofb.c
index bd30aba..731d7a5 100644
--- a/drivers/video/neofb.c
+++ b/drivers/video/neofb.c
@@ -1286,34 +1286,36 @@ static int neofb_setcolreg(u_int regno, 
 	if (regno >= fb->cmap.len || regno > 255)
 		return -EINVAL;
 
-	switch (fb->var.bits_per_pixel) {
-	case 8:
+	if (fb->var.bits_per_pixel <= 8) {
 		outb(regno, 0x3c8);
 
 		outb(red >> 10, 0x3c9);
 		outb(green >> 10, 0x3c9);
 		outb(blue >> 10, 0x3c9);
-		break;
-	case 16:
-		((u32 *) fb->pseudo_palette)[regno] =
+	} else if (regno < 16) {
+		switch (fb->var.bits_per_pixel) {
+		case 16:
+			((u32 *) fb->pseudo_palette)[regno] =
 				((red & 0xf800)) | ((green & 0xfc00) >> 5) |
 				((blue & 0xf800) >> 11);
-		break;
-	case 24:
-		((u32 *) fb->pseudo_palette)[regno] =
+			break;
+		case 24:
+			((u32 *) fb->pseudo_palette)[regno] =
 				((red & 0xff00) << 8) | ((green & 0xff00)) |
 				((blue & 0xff00) >> 8);
-		break;
+			break;
 #ifdef NO_32BIT_SUPPORT_YET
-	case 32:
-		((u32 *) fb->pseudo_palette)[regno] =
+		case 32:
+			((u32 *) fb->pseudo_palette)[regno] =
 				((transp & 0xff00) << 16) | ((red & 0xff00) << 8) |
 				((green & 0xff00)) | ((blue & 0xff00) >> 8);
-		break;
+			break;
 #endif
-	default:
-		return 1;
+		default:
+			return 1;
+		}
 	}
+
 	return 0;
 }
 

  parent reply	other threads:[~2007-05-30 22:14 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-27  9:06 tty-related oops in latest kernel(s)? Tero Roponen
2007-05-28  7:22 ` Pekka Enberg
2007-05-28  7:47   ` Pekka Enberg
2007-05-28  8:08   ` Tero Roponen
2007-05-28  9:34   ` Pekka Enberg
2007-05-29 16:04     ` Tero Roponen
2007-05-29 18:57       ` Pekka Enberg
2007-05-30  3:43         ` Tero Roponen
2007-05-30  3:57         ` Tero Roponen
2007-05-30  5:54           ` Pekka Enberg
2007-05-30  5:59             ` Pekka Enberg
2007-05-30  6:00             ` Tero Roponen
2007-05-30 12:02             ` Tero Roponen
2007-05-30 15:39               ` Andrew Morton
2007-05-30 16:01                 ` Tero Roponen
2007-05-30 16:09                   ` Andrew Morton
2007-05-30 18:04                     ` Alexey Dobriyan
2007-05-30 23:14                       ` Antonino A. Daplas
2007-05-30 23:14                         ` Antonino A. Daplas
2007-05-30 23:18                         ` David Miller
2007-05-30 23:18                           ` David Miller
2007-05-30 23:28                           ` Antonino A. Daplas
2007-05-30 23:28                             ` Antonino A. Daplas
2007-05-31  7:17                         ` Geert Uytterhoeven
2007-05-31  7:17                           ` [Linux-fbdev-devel] " Geert Uytterhoeven
2007-05-31  9:04                           ` Antonino A. Daplas
2007-05-31  9:04                             ` [Linux-fbdev-devel] " Antonino A. Daplas
2007-05-30 18:13                   ` Pekka Enberg
2007-05-30 18:27                     ` Tero Roponen
2007-05-30 22:14                   ` Antonino A. Daplas [this message]
2007-05-30 23:17                   ` Antonino A. Daplas

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=1180563258.4570.6.camel@daplas \
    --to=adaplas@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=apw@shadowen.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penberg@cs.helsinki.fi \
    --cc=teanropo@jyu.fi \
    /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.