diff options
| author | Lafcadio Wluiki <[email protected]> | 2017-02-24 23:00:23 +0000 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2017-02-25 01:46:56 +0000 |
| commit | 796f571b0c5cf3efd2f652779770fa7bbbc2bb03 (patch) | |
| tree | 56ce6af76056517dd861c1f9254c162291e72f41 /fs/proc/root.c | |
| parent | proc: less code duplication in /proc/*/cmdline (diff) | |
| download | kernel-796f571b0c5cf3efd2f652779770fa7bbbc2bb03.tar.gz kernel-796f571b0c5cf3efd2f652779770fa7bbbc2bb03.zip | |
procfs: use an enum for possible hidepid values
Previously, the hidepid parameter was checked by comparing literal
integers 0, 1, 2. Let's add a proper enum for this, to make the
checking more expressive:
0 → HIDEPID_OFF
1 → HIDEPID_NO_ACCESS
2 → HIDEPID_INVISIBLE
This changes the internal labelling only, the userspace-facing interface
remains unmodified, and still works with literal integers 0, 1, 2.
No functional changes.
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Lafcadio Wluiki <[email protected]>
Signed-off-by: Djalal Harouni <[email protected]>
Acked-by: Kees Cook <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'fs/proc/root.c')
| -rw-r--r-- | fs/proc/root.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/proc/root.c b/fs/proc/root.c index 1988440b2049..b90da888b81a 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c @@ -58,7 +58,8 @@ int proc_parse_options(char *options, struct pid_namespace *pid) case Opt_hidepid: if (match_int(&args[0], &option)) return 0; - if (option < 0 || option > 2) { + if (option < HIDEPID_OFF || + option > HIDEPID_INVISIBLE) { pr_err("proc: hidepid value must be between 0 and 2.\n"); return 0; } |
