Skip to contentSkip to conversation

Fix use of uninitialized variable in drivers/video/sis/init301.c::SiS_DDC2Delay()

PATCH In review Jesper Juhl 2 participants 4 messages Oct 23, 2006 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix use of uninitialized variable in drivers/video/sis/init301.c::SiS_DDC2Delay()

The variable 'j' is used uninitialized in the loop. Fix by initializing it to zero.

---

 drivers/video/sis/init301.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/video/sis/init301.c +2 -1
index f13fadd..f65bedb 100644
@@ -445,7 +445,8 @@ #endif
 void
 SiS_DDC2Delay(struct SiS_Private *SiS_Pr, unsigned int delaytime)
 {
-   unsigned int i, j;
+   unsigned int i
+   unsigned int j = 0;
 
    for(i = 0; i < delaytime; i++) {
       j += SiS_GetReg(SiS_Pr->SiS_P3c4,0x05);
#1 lore raw
Quoted 15 lines · Jesper Juhl

The variable 'j' is used uninitialized in the loop. Fix by initializing it to zero.

---

 drivers/video/sis/init301.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/video/sis/init301.c +0 -0
index f13fadd..f65bedb 100644

drivers/video/sis/init301.c #endif · line 452

Quoted 9 lines
drivers/video/sis/init301.c +2 -1
@@ -445,7 +445,8 @@ #endif
 void
 SiS_DDC2Delay(struct SiS_Private *SiS_Pr, unsigned int delaytime)
 {
-   unsigned int i, j;
+   unsigned int i
+   unsigned int j = 0;
 
    for(i = 0; i < delaytime; i++) {
       j += SiS_GetReg(SiS_Pr->SiS_P3c4,0x05);

I doubt this patch compile tested.

David

#2 lore raw
Quoted 4 lines · David Rientjes
Quoted 2 lines · Jesper Juhl

The variable 'j' is used uninitialized in the loop. Fix by initializing it to zero.

[snip]

Quoted 3 lines

I doubt this patch compile tested.

You are right. I hang my head in shame and admit I did not compile test this one. Fixed patch below.

---

 drivers/video/sis/init301.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/video/sis/init301.c +2 -1
index f13fadd..45a5969 100644
@@ -445,7 +445,8 @@ #endif
 void
 SiS_DDC2Delay(struct SiS_Private *SiS_Pr, unsigned int delaytime)
 {
-   unsigned int i, j;
+   unsigned int i;
+   unsigned int j = 0;
 
    for(i = 0; i < delaytime; i++) {
       j += SiS_GetReg(SiS_Pr->SiS_P3c4,0x05);
#3 lore raw
Quoted 25 lines · Jesper Juhl
Quoted 4 lines · David Rientjes
Quoted 2 lines · Jesper Juhl

The variable 'j' is used uninitialized in the loop. Fix by initializing it to zero.

[snip]

Quoted 3 lines

I doubt this patch compile tested.

You are right. I hang my head in shame and admit I did not compile test this one. Fixed patch below.

---

 drivers/video/sis/init301.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/video/sis/init301.c +0 -0
index f13fadd..45a5969 100644

drivers/video/sis/init301.c #endif · line 452

Quoted 9 lines
drivers/video/sis/init301.c +2 -1
@@ -445,7 +445,8 @@ #endif
 void
 SiS_DDC2Delay(struct SiS_Private *SiS_Pr, unsigned int delaytime)
 {
-   unsigned int i, j;
+   unsigned int i;
+   unsigned int j = 0;
 
    for(i = 0; i < delaytime; i++) {
       j += SiS_GetReg(SiS_Pr->SiS_P3c4,0x05);

Damn it, my brain seems to be non-functional tonight.
'j' is not used at all. just ignore this patch. I'll come up with something proper some other day - right now it's obviously time for me to get some sleep.

Signature · 3 lines
Jesper Juhl <[email protected]>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html