lkml.org 
[lkml]   [2020]   [Mar]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] pid: fix uninitialized var warnings
Date
Compiling with gcc-9.2.1 points out below warnings. Fix it.

kernel/pid.c: In function 'alloc_pid':
kernel/pid.c:180:10: warning: 'retval' may be used uninitialized
in this function [-Wmaybe-uninitialized]

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Christian Brauner <christian@brauner.io>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Walter Wu <walter-zh.wu@mediatek.com>
---
kernel/pid.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/pid.c b/kernel/pid.c
index ff6cd6786d10..02944cfd4e51 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -176,8 +176,10 @@ struct pid *alloc_pid(struct pid_namespace *ns, pid_t *set_tid,
return ERR_PTR(-EINVAL);

pid = kmem_cache_alloc(ns->pid_cachep, GFP_KERNEL);
- if (!pid)
+ if (!pid) {
+ retval = -ENOMEM;
return ERR_PTR(retval);
+ }

tmp = ns;
pid->level = ns->level;
--
2.18.0
\
 
 \ /
  Last update: 2020-03-11 13:21    [W:0.090 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site