[PATCH] ppc64: fix prom.c compile warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The code in unflatten_device_tree knows that get_property is written to
only return with lenp equal to 1 when also returning a valid pointer.
The gcc 3.3.3 compiler is not able to prove this to itself, so it warns
about a possible uninitialized pointer dereference:

 .../arch/ppc64/kernel/prom.c: In function `unflatten_device_tree':
 .../arch/ppc64/kernel/prom.c:828:
 warning: `p' might be used uninitialized in this function

Unless it is desired to rework the interaction between the two
functions, this will keep the existing behavior but quiet the compiler.

Signed-off-by: Amos Waterland <[email protected]>
Signed-off-by: Paul Mackerras <[email protected]>
---
diff -urN linux-2.6/arch/ppc64/kernel/prom.c test/arch/ppc64/kernel/prom.c
--- linux-2.6/arch/ppc64/kernel/prom.c	2005-05-02 08:29:36.000000000 +1000
+++ test/arch/ppc64/kernel/prom.c	2005-05-06 13:27:29.000000000 +1000
@@ -834,7 +834,7 @@
 {
 	unsigned long start, mem, size;
 	struct device_node **allnextp = &allnodes;
-	char *p;
+	char *p = NULL;
 	int l = 0;
 
 	DBG(" -> unflatten_device_tree()\n");
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux