aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/self.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc/self.c')
-rw-r--r--fs/proc/self.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/proc/self.c b/fs/proc/self.c
index 31326bb23b8b..4d7d061696b3 100644
--- a/fs/proc/self.c
+++ b/fs/proc/self.c
@@ -1,4 +1,5 @@
1// SPDX-License-Identifier: GPL-2.0 1// SPDX-License-Identifier: GPL-2.0
2#include <linux/cache.h>
2#include <linux/sched.h> 3#include <linux/sched.h>
3#include <linux/slab.h> 4#include <linux/slab.h>
4#include <linux/pid_namespace.h> 5#include <linux/pid_namespace.h>
@@ -17,11 +18,11 @@ static const char *proc_self_get_link(struct dentry *dentry,
17 18
18 if (!tgid) 19 if (!tgid)
19 return ERR_PTR(-ENOENT); 20 return ERR_PTR(-ENOENT);
20 /* 11 for max length of signed int in decimal + NULL term */ 21 /* max length of unsigned int in decimal + NULL term */
21 name = kmalloc(12, dentry ? GFP_KERNEL : GFP_ATOMIC); 22 name = kmalloc(10 + 1, dentry ? GFP_KERNEL : GFP_ATOMIC);
22 if (unlikely(!name)) 23 if (unlikely(!name))
23 return dentry ? ERR_PTR(-ENOMEM) : ERR_PTR(-ECHILD); 24 return dentry ? ERR_PTR(-ENOMEM) : ERR_PTR(-ECHILD);
24 sprintf(name, "%d", tgid); 25 sprintf(name, "%u", tgid);
25 set_delayed_call(done, kfree_link, name); 26 set_delayed_call(done, kfree_link, name);
26 return name; 27 return name;
27} 28}
@@ -30,7 +31,7 @@ static const struct inode_operations proc_self_inode_operations = {
30 .get_link = proc_self_get_link, 31 .get_link = proc_self_get_link,
31}; 32};
32 33
33static unsigned self_inum; 34static unsigned self_inum __ro_after_init;
34 35
35int proc_setup_self(struct super_block *s) 36int proc_setup_self(struct super_block *s)
36{ 37{