aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/self.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-02-07 01:15:42 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-02-07 01:15:42 -0500
commita2e5790d841658485d642196dbb0927303d6c22f (patch)
treeb3d28c9bcb7da6880806146fd22a88a7ee7f733e /fs/proc/self.c
parentab2d92ad881da11331280aedf612d82e61cb6d41 (diff)
parent60c3e026d73ccabb075fb70ba02f8512ab40cf2c (diff)
Merge branch 'akpm' (patches from Andrew)
Merge misc updates from Andrew Morton: - kasan updates - procfs - lib/bitmap updates - other lib/ updates - checkpatch tweaks - rapidio - ubsan - pipe fixes and cleanups - lots of other misc bits * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (114 commits) Documentation/sysctl/user.txt: fix typo MAINTAINERS: update ARM/QUALCOMM SUPPORT patterns MAINTAINERS: update various PALM patterns MAINTAINERS: update "ARM/OXNAS platform support" patterns MAINTAINERS: update Cortina/Gemini patterns MAINTAINERS: remove ARM/CLKDEV SUPPORT file pattern MAINTAINERS: remove ANDROID ION pattern mm: docs: add blank lines to silence sphinx "Unexpected indentation" errors mm: docs: fix parameter names mismatch mm: docs: fixup punctuation pipe: read buffer limits atomically pipe: simplify round_pipe_size() pipe: reject F_SETPIPE_SZ with size over UINT_MAX pipe: fix off-by-one error when checking buffer limits pipe: actually allow root to exceed the pipe buffer limits pipe, sysctl: remove pipe_proc_fn() pipe, sysctl: drop 'min' parameter from pipe-max-size converter kasan: rework Kconfig settings crash_dump: is_kdump_kernel can be boolean kernel/mutex: mutex_is_locked can be boolean ...
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{