linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luis Chamberlain <mcgrof@kernel.org>
To: akpm@linux-foundation.org, viro@zeniv.linux.org.uk,
	keescook@chromium.org, yzaikin@google.com, nixiaoming@huawei.com,
	ebiederm@xmission.com, steve@sk2.org,
	mcgrof@bombadil.infradead.org, mcgrof@kernel.org,
	andriy.shevchenko@linux.intel.com, jlayton@kernel.org,
	bfields@fieldses.org
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 4/9] sysctl: move maxolduid as a sysctl specific const
Date: Mon, 29 Nov 2021 12:55:43 -0800	[thread overview]
Message-ID: <20211129205548.605569-5-mcgrof@kernel.org> (raw)
In-Reply-To: <20211129205548.605569-1-mcgrof@kernel.org>

The maxolduid value is only shared for sysctl purposes for
use on a max range. Just stuff this into our shared const
array.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 fs/proc/proc_sysctl.c  |  2 +-
 include/linux/sysctl.h |  3 +++
 kernel/sysctl.c        | 12 ++++--------
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 7dec3d5a9ed4..675b625fa898 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -26,7 +26,7 @@ static const struct file_operations proc_sys_dir_file_operations;
 static const struct inode_operations proc_sys_dir_operations;
 
 /* shared constants to be used in various sysctls */
-const int sysctl_vals[] = { -1, 0, 1, 2, 4, 100, 200, 1000, 3000, INT_MAX };
+const int sysctl_vals[] = { -1, 0, 1, 2, 4, 100, 200, 1000, 65535, INT_MAX };
 EXPORT_SYMBOL(sysctl_vals);
 
 const unsigned long sysctl_long_vals[] = { 0, 1, LONG_MAX };
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 2de6d20d191b..bb921eb8a02d 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -49,6 +49,9 @@ struct ctl_dir;
 #define SYSCTL_THREE_THOUSAND		((void *)&sysctl_vals[8])
 #define SYSCTL_INT_MAX			((void *)&sysctl_vals[9])
 
+/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
+#define SYSCTL_MAXOLDUID		((void *)&sysctl_vals[10])
+
 extern const int sysctl_vals[];
 
 #define SYSCTL_LONG_ZERO	((void *)&sysctl_long_vals[0])
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index dbd267d0f014..05d9dd85e17f 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -109,10 +109,6 @@ static const int six_hundred_forty_kb = 640 * 1024;
 /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
 static const unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
 
-/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
-static const int maxolduid = 65535;
-/* minolduid is SYSCTL_ZERO */
-
 static const int ngroups_max = NGROUPS_MAX;
 static const int cap_last_cap = CAP_LAST_CAP;
 
@@ -2126,7 +2122,7 @@ static struct ctl_table kern_table[] = {
 		.mode		= 0644,
 		.proc_handler	= proc_dointvec_minmax,
 		.extra1		= SYSCTL_ZERO,
-		.extra2		= (void *)&maxolduid,
+		.extra2		= SYSCTL_MAXOLDUID,
 	},
 	{
 		.procname	= "overflowgid",
@@ -2135,7 +2131,7 @@ static struct ctl_table kern_table[] = {
 		.mode		= 0644,
 		.proc_handler	= proc_dointvec_minmax,
 		.extra1		= SYSCTL_ZERO,
-		.extra2		= (void *)&maxolduid,
+		.extra2		= SYSCTL_MAXOLDUID,
 	},
 #ifdef CONFIG_S390
 	{
@@ -2907,7 +2903,7 @@ static struct ctl_table fs_table[] = {
 		.mode		= 0644,
 		.proc_handler	= proc_dointvec_minmax,
 		.extra1		= SYSCTL_ZERO,
-		.extra2		= (void *)&maxolduid,
+		.extra2		= SYSCTL_MAXOLDUID,
 	},
 	{
 		.procname	= "overflowgid",
@@ -2916,7 +2912,7 @@ static struct ctl_table fs_table[] = {
 		.mode		= 0644,
 		.proc_handler	= proc_dointvec_minmax,
 		.extra1		= SYSCTL_ZERO,
-		.extra2		= (void *)&maxolduid,
+		.extra2		= SYSCTL_MAXOLDUID,
 	},
 #ifdef CONFIG_FILE_LOCKING
 	{
-- 
2.33.0


  parent reply	other threads:[~2021-11-29 22:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-29 20:55 [PATCH 0/9] sysctl: 4th set of kernel/sysctl cleanups Luis Chamberlain
2021-11-29 20:55 ` [PATCH 1/9] fs: move inode sysctls to its own file Luis Chamberlain
2021-11-29 20:55 ` [PATCH 2/9] fs: move fs stat sysctls to file_table.c Luis Chamberlain
2021-11-29 20:55 ` [PATCH 3/9] fs: move dcache sysctls to its own file Luis Chamberlain
2021-11-29 20:55 ` Luis Chamberlain [this message]
2021-12-17 16:15   ` [PATCH 4/9] sysctl: move maxolduid as a sysctl specific const Mickaël Salaün
2021-12-20 19:25     ` Luis Chamberlain
2021-12-30  0:46       ` Andrew Morton
2021-12-30 11:24         ` Mickaël Salaün
2021-11-29 20:55 ` [PATCH 5/9] fs: move shared sysctls to fs/sysctls.c Luis Chamberlain
2021-11-29 20:55 ` [PATCH 6/9] fs: move locking sysctls where they are used Luis Chamberlain
2021-11-29 20:55 ` [PATCH 7/9] fs: move namei sysctls to its own file Luis Chamberlain
2021-11-29 20:55 ` [PATCH 8/9] fs: move fs/exec.c sysctls into " Luis Chamberlain
2021-11-29 20:55 ` [PATCH 9/9] fs: move pipe sysctls to is " Luis Chamberlain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211129205548.605569-5-mcgrof@kernel.org \
    --to=mcgrof@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bfields@fieldses.org \
    --cc=ebiederm@xmission.com \
    --cc=jlayton@kernel.org \
    --cc=keescook@chromium.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@bombadil.infradead.org \
    --cc=nixiaoming@huawei.com \
    --cc=steve@sk2.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=yzaikin@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).