Re: linux-next: build warning after merge of the akpm tree

From: Cyrill Gorcunov
Date: Fri Apr 27 2012 - 02:22:20 EST


On Fri, Apr 27, 2012 at 03:44:20PM +1000, Stephen Rothwell wrote:
> Hi Andrew,
>
> After merging the akpm tree, today's linux-next build ()
> produced this warning:
>
> kernel/sys.c: In function 'prctl_set_mm':
> kernel/sys.c:1779:6: warning: 'error' may be used uninitialized in this function [-Wuninitialized]
>
> And this is not a false positive (I think).
>
> Introduced by commit 5455a20be1a6 ("c/r: prctl: extend PR_SET_MM to set
> up more mm_struct entries").

Hi Stephen, thanks for report, have no idea how it happened, since
commit 5455a20be1a6 _has_ error = -EINVAL; line.
Anyway, here is a fix.

Cyrill
---
From: Cyrill Gorcunov <gorcunov@xxxxxxxxxx>
Subject: [PATCH -mm] c/r: prctl: Add error initialization

Reported-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
Signed-off-by: Cyrill Gorcunov <gorcunov@xxxxxxxxxx>
CC: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
CC: Kees Cook <keescook@xxxxxxxxxxxx>
---
kernel/sys.c | 2 ++
1 file changed, 2 insertions(+)

Index: linux-2.6.git/kernel/sys.c
===================================================================
--- linux-2.6.git.orig/kernel/sys.c
+++ linux-2.6.git/kernel/sys.c
@@ -1790,6 +1790,8 @@ static int prctl_set_mm(int opt, unsigne
if (addr >= TASK_SIZE)
return -EINVAL;

+ error = -EINVAL;
+
down_read(&mm->mmap_sem);
vma = find_vma(mm, addr);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/