linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] modedb: fix incorrect sync and vmode flags for CVT modes
@ 2008-05-28 20:49 Krzysztof Helt
  2008-05-28 20:56 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Krzysztof Helt @ 2008-05-28 20:49 UTC (permalink / raw)
  To: Linux-fbdev-devel; +Cc: Andrew Morton

From: Krzysztof Helt <krzysztof.h1@wp.pl>

The temporary structure for calculated CVT mode
is not initialized. Few fields have only bits or-ed
or and-ed so they may be left in incorrect (random) state.

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>

---
It would be good to have this fix in 2.6.26.

Testing of the tridentfb seems like a good exercise
for the fbdev layer.

diff -urp linux-2.6.25/drivers/video/modedb.c linux-new/drivers/video/modedb.c
--- linux-2.6.25/drivers/video/modedb.c	2008-05-27 21:57:38.644359809 +0200
+++ linux-new/drivers/video/modedb.c	2008-05-28 22:40:26.149499108 +0200
@@ -590,6 +590,7 @@ done:
 		    "", (margins) ? " with margins" : "", (interlace) ?
 		    " interlaced" : "");
 
+	    memset(&cvt_mode, 0, sizeof(struct fb_videomode));
 	    cvt_mode.xres = xres;
 	    cvt_mode.yres = yres;
 	    cvt_mode.refresh = (refresh) ? refresh : 60;

----------------------------------------------------------------------
Tanie rozmowy!
Sprawdz >>> http://link.interia.pl/f1e13  


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] modedb: fix incorrect sync and vmode flags for CVT modes
  2008-05-28 20:49 [PATCH] modedb: fix incorrect sync and vmode flags for CVT modes Krzysztof Helt
@ 2008-05-28 20:56 ` Andrew Morton
  2008-05-28 21:48   ` Krzysztof Helt
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2008-05-28 20:56 UTC (permalink / raw)
  To: Krzysztof Helt; +Cc: linux-fbdev-devel

On Wed, 28 May 2008 22:49:21 +0200
Krzysztof Helt <krzysztof.h1@poczta.fm> wrote:

> Testing of the tridentfb seems like a good exercise
> for the fbdev layer.

heh.

> +	    memset(&cvt_mode, 0, sizeof(struct fb_videomode));

I think using sizeof(cvt_mode) is better here.  Then the reader doesn't
have to go and hunt down the definition of cvt_mode.  

Or even

--- a/drivers/video/modedb.c~a
+++ a/drivers/video/modedb.c
@@ -582,7 +582,7 @@ int fb_find_mode(struct fb_var_screeninf
 	}
 done:
 	if (cvt) {
-	    struct fb_videomode cvt_mode;
+	    struct fb_videomode cvt_mode = { };
 	    int ret;
 
 	    DPRINTK("CVT mode %dx%d@%dHz%s%s%s\n", xres, yres,
_

however gcc might generate sucky code for that.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] modedb: fix incorrect sync and vmode flags for CVT modes
  2008-05-28 20:56 ` Andrew Morton
@ 2008-05-28 21:48   ` Krzysztof Helt
  0 siblings, 0 replies; 3+ messages in thread
From: Krzysztof Helt @ 2008-05-28 21:48 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-fbdev-devel

On Wed, 28 May 2008 13:56:20 -0700
Andrew Morton <akpm@linux-foundation.org> wrote:

> On Wed, 28 May 2008 22:49:21 +0200
> Krzysztof Helt <krzysztof.h1@poczta.fm> wrote:
> 
> > Testing of the tridentfb seems like a good exercise
> > for the fbdev layer.
> 
> heh.
> 
> > +	    memset(&cvt_mode, 0, sizeof(struct fb_videomode));
> 
> I think using sizeof(cvt_mode) is better here.  Then the reader doesn't
> have to go and hunt down the definition of cvt_mode.  
> 

Here it is. Or just modify my previous patch.

From: Krzysztof Helt <krzysztof.h1@wp.pl>

The temporary structure for calculated CVT mode
is not initialized. Few fields have only bits or-ed
or and-ed so they may be left in incorrect (random) state.

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>

diff -urp linux-2.6.25/drivers/video/modedb.c linux-new/drivers/video/modedb.c
--- linux-2.6.25/drivers/video/modedb.c	2008-05-27 21:57:38.644359809 +0200
+++ linux-new/drivers/video/modedb.c	2008-05-28 23:38:51.045496496 +0200
@@ -590,6 +590,7 @@ done:
 		    "", (margins) ? " with margins" : "", (interlace) ?
 		    " interlaced" : "");
 
+	    memset(&cvt_mode, 0, sizeof(cvt_mode));
 	    cvt_mode.xres = xres;
 	    cvt_mode.yres = yres;
 	    cvt_mode.refresh = (refresh) ? refresh : 60;



----------------------------------------------------------------------
Podbij Dziki Zachod!Gra strategiczna online
Sprawdz >>> http://link.interia.pl/f1dff


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-05-28 21:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-28 20:49 [PATCH] modedb: fix incorrect sync and vmode flags for CVT modes Krzysztof Helt
2008-05-28 20:56 ` Andrew Morton
2008-05-28 21:48   ` Krzysztof Helt

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).