mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -mm] riva CalcStateExt gcc 4.1 warning fix
@ 2006-05-10  2:56 Daniel Walker
  2006-05-10 10:35 ` Alan Cox
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Walker @ 2006-05-10  2:56 UTC (permalink / raw)
  To: akpm; +Cc: jgarzik, linux-kernel

This could be a bug. The return from CalcVClock isn't checked
so the variables in questions could be random data ..

Fixes the following warning,

drivers/video/riva/riva_hw.c: In function 'CalcStateExt':
drivers/video/riva/riva_hw.c:1241: warning: 'p' may be used uninitialized in this function
drivers/video/riva/riva_hw.c:1241: warning: 'n' may be used uninitialized in this function
drivers/video/riva/riva_hw.c:1241: warning: 'm' may be used uninitialized in this function
drivers/video/riva/riva_hw.c:1241: warning: 'VClk' may be used uninitialized in this function


Signed-Off-By: Daniel Walker <dwalker@mvista.com>

Index: linux-2.6.16/drivers/video/riva/riva_hw.c
===================================================================
--- linux-2.6.16.orig/drivers/video/riva/riva_hw.c
+++ linux-2.6.16/drivers/video/riva/riva_hw.c
@@ -1238,7 +1238,12 @@ static void CalcStateExt
     int            dotClock
 )
 {
-    int pixelDepth, VClk, m, n, p;
+    int pixelDepth;
+    int VClk = 0;
+    int m = 0;
+    int n = 0;
+    int p = 0;
+
     /*
      * Save mode parameters.
      */

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

* Re: [PATCH -mm] riva CalcStateExt gcc 4.1 warning fix
  2006-05-10  2:56 [PATCH -mm] riva CalcStateExt gcc 4.1 warning fix Daniel Walker
@ 2006-05-10 10:35 ` Alan Cox
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Cox @ 2006-05-10 10:35 UTC (permalink / raw)
  To: Daniel Walker; +Cc: akpm, jgarzik, linux-kernel

On Maw, 2006-05-09 at 19:56 -0700, Daniel Walker wrote:
> This could be a bug. The return from CalcVClock isn't checked
> so the variables in questions could be random data ..
> 
> Fixes the following warning,
> 
> drivers/video/riva/riva_hw.c: In function 'CalcStateExt':
> drivers/video/riva/riva_hw.c:1241: warning: 'p' may be used uninitialized in this function
> drivers/video/riva/riva_hw.c:1241: warning: 'n' may be used uninitialized in this function
> drivers/video/riva/riva_hw.c:1241: warning: 'm' may be used uninitialized in this function
> drivers/video/riva/riva_hw.c:1241: warning: 'VClk' may be used uninitialized in this function

But zero isn't valid data. You need to fix the missing return check not
hide the warnings. This goes for just about every patch in this series


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

end of thread, other threads:[~2006-05-10 10:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-10  2:56 [PATCH -mm] riva CalcStateExt gcc 4.1 warning fix Daniel Walker
2006-05-10 10:35 ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®