[PATCH] powerpc: fix uninitialised error in numa.c

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

STALE5223d

4 messages, 2 authors, 2012-06-20 · open the first message on its own page

[PATCH] powerpc: fix uninitialised error in numa.c

From: Michael Neuling <hidden>
Date: 2012-06-20 04:17:47

chroma_defconfig currently gives me this with gcc 4.6:
  arch/powerpc/mm/numa.c:638:13: error: 'dm' may be used uninitialized in this function [-Werror=uninitialized]

It's a bogus warning since of_get_drconf_memory() only writes it
anyway.  

Signed-off-by: Michael Neuling <redacted>
cc: stable@kernel.org
---
Also affects 3.4 and 3.3 stable.
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 5ca3a15..880acde 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -637,7 +637,7 @@ static inline int __init read_usm_ranges(const u32 **usm)
  */
 static void __init parse_drconf_memory(struct device_node *memory)
 {
-	const u32 *dm, *usm;
+	const u32 *dm = NULL, *usm;
 	unsigned int n, rc, ranges, is_kexec_kdump = 0;
 	unsigned long lmb_size, base, size, sz;
 	int nid;

Re: [PATCH] powerpc: fix uninitialised error in numa.c

From: Tony Breeds <hidden>
Date: 2012-06-20 05:38:08

On Wed, Jun 20, 2012 at 02:17:47PM +1000, Michael Neuling wrote:
quoted hunk
chroma_defconfig currently gives me this with gcc 4.6:
  arch/powerpc/mm/numa.c:638:13: error: 'dm' may be used uninitialized in this function [-Werror=uninitialized]

It's a bogus warning since of_get_drconf_memory() only writes it
anyway.  

Signed-off-by: Michael Neuling <redacted>
cc: stable@kernel.org
---
Also affects 3.4 and 3.3 stable.
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 5ca3a15..880acde 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -637,7 +637,7 @@ static inline int __init read_usm_ranges(const u32 **usm)
  */
 static void __init parse_drconf_memory(struct device_node *memory)
 {
-	const u32 *dm, *usm;
+	const u32 *dm = NULL, *usm;
Woot bikeshed!  I think that's what the uninitialized_var() macro is for.

Yours Tony

Re: [PATCH] powerpc: fix uninitialised error in numa.c

From: Michael Neuling <hidden>
Date: 2012-06-20 05:46:06

Tony Breeds [off-list ref] wrote:
On Wed, Jun 20, 2012 at 02:17:47PM +1000, Michael Neuling wrote:
quoted
chroma_defconfig currently gives me this with gcc 4.6:
  arch/powerpc/mm/numa.c:638:13: error: 'dm' may be used uninitialized in this function [-Werror=uninitialized]

It's a bogus warning since of_get_drconf_memory() only writes it
anyway.  

Signed-off-by: Michael Neuling <redacted>
cc: stable@kernel.org
---
Also affects 3.4 and 3.3 stable.
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 5ca3a15..880acde 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -637,7 +637,7 @@ static inline int __init read_usm_ranges(const u32 **usm)
  */
 static void __init parse_drconf_memory(struct device_node *memory)
 {
-	const u32 *dm, *usm;
+	const u32 *dm = NULL, *usm;
Woot bikeshed!  I think that's what the uninitialized_var() macro is for.
Doesn't work here.  Produces the same error.

Mikey

[PATCH] powerpc: fix uninitialised error in numa.c

From: Michael Neuling <hidden>
Date: 2012-06-20 06:01:45

chroma_defconfig currently gives me this with gcc 4.6:
  arch/powerpc/mm/numa.c:638:13: error: 'dm' may be used uninitialized in this function [-Werror=uninitialized]

It's a bogus warning/error since of_get_drconf_memory() only writes it
anyway.

Signed-off-by: Michael Neuling <redacted>
cc: stable@kernel.org
---
quoted
quoted
 static void __init parse_drconf_memory(struct device_node *memory)
 {
-	const u32 *dm, *usm;
+	const u32 *dm = NULL, *usm;
Woot bikeshed!  I think that's what the uninitialized_var() macro is for.
Doesn't work here.  Produces the same error.
My bad.. I was using it wrong

Still affects 3.4 and 3.3 stable.
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 5ca3a15..7c28589 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -637,7 +637,7 @@ static inline int __init read_usm_ranges(const u32 **usm)
  */
 static void __init parse_drconf_memory(struct device_node *memory)
 {
-	const u32 *dm, *usm;
+	const u32 *uninitialized_var(dm), *usm;
 	unsigned int n, rc, ranges, is_kexec_kdump = 0;
 	unsigned long lmb_size, base, size, sz;
 	int nid;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help