lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200311122049.11589-1-walter-zh.wu@mediatek.com>
Date:   Wed, 11 Mar 2020 20:20:49 +0800
From:   Walter Wu <walter-zh.wu@...iatek.com>
To:     Andrew Morton <akpm@...ux-foundation.org>,
        Christian Brauner <christian@...uner.io>,
        Oleg Nesterov <oleg@...hat.com>
CC:     <linux-kernel@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        wsd_upstream <wsd_upstream@...iatek.com>,
        Walter Wu <walter-zh.wu@...iatek.com>
Subject: [PATCH] pid: fix uninitialized var warnings

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@...ux-foundation.org>
Cc: Christian Brauner <christian@...uner.io>
Cc: Oleg Nesterov <oleg@...hat.com>
Signed-off-by: Walter Wu <walter-zh.wu@...iatek.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ