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 a return value in alloc_pid
Date
When I doing a make about linux-next in X86 right now,it prompts a 
warning about "‘retval’ may be used uninitialized in this function
[-Wmaybe-uninitialized]". So I found that undefined 'retval' initially
in alloc_pid(),so the return ERR_PTR(retval) was an uncertain value.
Kmem_cache_alloc() is for sapce,so it will return ERR_PTR(-ENOMEM) if
unsuccessful.

Signed-off-by: tangbin <tangbin@cmss.chinamobile.com>
---
kernel/pid.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/pid.c b/kernel/pid.c
index ff6cd67..f214094 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -177,7 +177,7 @@ struct pid *alloc_pid(struct pid_namespace *ns, pid_t *set_tid,

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

tmp = ns;
pid->level = ns->level;
--
2.7.4


\
 
 \ /
  Last update: 2020-03-11 09:20    [W:0.026 / U:35.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site