Skip to contentSkip to conversation

fix uninitialized warnings in mempolicy.c

PATCH New Jesse Barnes 2 participants 3 messages Sep 10, 2004 – Sep 11, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix uninitialized warnings in mempolicy.c

Sorry if you already got these fixes, but err may be used uninitialized in mempolicy.c in both compat_set_mempolicy and compat_mbind. This patch fixes that by setting them both to 0.

===== mm/mempolicy.c 1.14 vs edited =====

mm/mempolicy.c +2 -2
@@ -557,7 +557,7 @@
 asmlinkage long compat_set_mempolicy(int mode, compat_ulong_t __user *nmask,
 				     compat_ulong_t maxnode)
 {
-	long err;
+	long err = 0;
 	unsigned long __user *nm = NULL;
 	unsigned long nr_bits, alloc_size;
 	DECLARE_BITMAP(bm, MAX_NUMNODES);
@@ -581,7 +581,7 @@
 			     compat_ulong_t mode, compat_ulong_t __user *nmask,
 			     compat_ulong_t maxnode, compat_ulong_t flags)
 {
-	long err;
+	long err = 0;
 	unsigned long __user *nm = NULL;
 	unsigned long nr_bits, alloc_size;
 	DECLARE_BITMAP(bm, MAX_NUMNODES);
#1 lore raw

PATCH 1/1 Remove -Wno-uninitialized

Quoted 4 lines

Sorry if you already got these fixes, but err may be used uninitialized in mempolicy.c in both compat_set_mempolicy and compat_mbind. This patch fixes that by setting them both to 0.

Thanks Jesse, I wonder why I missed this. Yuck, that would explain it.

Andrew: A follow up patch fixing a bunch of ppc64 warnings is on the way.

Anton

===== arch/ppc64/Makefile 1.47 vs edited =====

arch/ppc64/Makefile +1 -2
@@ -26,8 +26,7 @@
 
 LDFLAGS		:= -m elf64ppc
 LDFLAGS_vmlinux	:= -Bstatic -e $(KERNELLOAD) -Ttext $(KERNELLOAD)
-CFLAGS		+= -msoft-float -pipe -Wno-uninitialized -mminimal-toc \
-		   -mtraceback=none
+CFLAGS		+= -msoft-float -pipe -mminimal-toc -mtraceback=none
 
 ifeq ($(CONFIG_POWER4_ONLY),y)
 	CFLAGS += $(call cc-option,-mcpu=power4)
#2 lore raw

PATCH 1/1 Remove -Wno-uninitialized

Remove -Wno-uninitialized on ppc32 too. Ive just found a number of real bugs on ppc64 by doing the same.

===== arch/ppc/Makefile 1.63 vs edited =====

arch/ppc/Makefile +1 -1
@@ -24,7 +24,7 @@
 CPPFLAGS	+= -Iarch/$(ARCH)
 AFLAGS		+= -Iarch/$(ARCH)
 CFLAGS		+= -Iarch/$(ARCH) -msoft-float -pipe \
-		-ffixed-r2 -Wno-uninitialized -mmultiple
+		-ffixed-r2 -mmultiple
 CPP		= $(CC) -E $(CFLAGS)
 
 CHECKFLAGS	+= -D__powerpc__=1