Skip to contentSkip to conversation

kernel/watchdog: Initialize 'result'

PATCH In review Kulikov Vasiliy 2 participants 3 messages Jul 5, 2010 – Jul 7, 2010 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel/watchdog: Initialize 'result'

Variable on the stack is not initialized to zero, do it explicitly.

This patch silences a compiler warning:
kernel/watchdog.c:463: warning: ‘result’ may be used uninitialized in this function

---
 kernel/watchdog.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/watchdog.c +1 -1
index 91b0b26..613bc1f 100644
@@ -460,7 +460,7 @@ static void watchdog_disable(int cpu)
 static void watchdog_enable_all_cpus(void)
 {
 	int cpu;
-	int result;
+	int result = 0;
 
 	for_each_online_cpu(cpu)
 		result += watchdog_enable(cpu);
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 4 lines · Kulikov Vasiliy

Variable on the stack is not initialized to zero, do it explicitly.

This patch silences a compiler warning:
kernel/watchdog.c:463: warning: ‘result’ may be used uninitialized in this function

Hmm, I thought I fixed that. oh well.

ACK.

Quoted 22 lines
---
 kernel/watchdog.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/watchdog.c +1 -1
index 91b0b26..613bc1f 100644
@@ -460,7 +460,7 @@ static void watchdog_disable(int cpu)
 static void watchdog_enable_all_cpus(void)
 {
 	int cpu;
-	int result;
+	int result = 0;
 
 	for_each_online_cpu(cpu)
 		result += watchdog_enable(cpu);
Signature · 1 line
1.7.0.4
#2 lore raw
In reply to Kulikov Vasiliy
Commit-ID:  eb703f98191a505f78d0066712ad67d5dedc4c90
Gitweb:     http://git.kernel.org/tip/eb703f98191a505f78d0066712ad67d5dedc4c90
Author:     Kulikov Vasiliy <[email protected]>
AuthorDate: Mon, 5 Jul 2010 12:00:54 +0400
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 7 Jul 2010 08:46:42 +0200

kernel/watchdog: Initialize 'result'

Variable on the stack is not initialized to zero, do it explicitly.

This bug was found by a compiler warning:

kernel/watchdog.c:463: warning: 'result' may be used uninitialized in this function

Cc Frederic Weisbecker <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Steven Rostedt <[email protected]>

LKML-Reference: <[email protected]>

---
 kernel/watchdog.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/watchdog.c +1 -1
index 91b0b26..613bc1f 100644
@@ -460,7 +460,7 @@ static void watchdog_disable(int cpu)
 static void watchdog_enable_all_cpus(void)
 {
 	int cpu;
-	int result;
+	int result = 0;
 
 	for_each_online_cpu(cpu)
 		result += watchdog_enable(cpu);