* [PATCH] pid: fix uninitialized var warnings
@ 2020-03-11 12:20 Walter Wu
2020-03-11 12:24 ` Christian Brauner
0 siblings, 1 reply; 2+ messages in thread
From: Walter Wu @ 2020-03-11 12:20 UTC (permalink / raw)
To: Andrew Morton, Christian Brauner, Oleg Nesterov
Cc: linux-kernel, linux-arm-kernel, wsd_upstream, Walter Wu
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] pid: fix uninitialized var warnings
2020-03-11 12:20 [PATCH] pid: fix uninitialized var warnings Walter Wu
@ 2020-03-11 12:24 ` Christian Brauner
0 siblings, 0 replies; 2+ messages in thread
From: Christian Brauner @ 2020-03-11 12:24 UTC (permalink / raw)
To: Walter Wu
Cc: Andrew Morton, Christian Brauner, Oleg Nesterov, linux-kernel,
linux-arm-kernel, wsd_upstream
On Wed, Mar 11, 2020 at 08:20:49PM +0800, Walter Wu wrote:
> 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>
Thanks. A correct fix for this is already in my tree:
https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git/commit/?h=fixes&id=10dab84caf400f2f5f8b010ebb0c7c4272ec5093
(Background is
https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git/commit/?h=fixes&id=b26ebfe12f34f372cf041c6f801fa49c3fb382c5
)
Christian
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-03-11 12:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-11 12:20 [PATCH] pid: fix uninitialized var warnings Walter Wu
2020-03-11 12:24 ` Christian Brauner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).