Patch "sysctl: share unsigned long const values" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    sysctl: share unsigned long const values

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     sysctl-share-unsigned-long-const-values.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 19204a941cffa0bb30965a16bb486823c815f854
Author: Luis Chamberlain <mcgrof@xxxxxxxxxx>
Date:   Fri Jan 21 22:12:48 2022 -0800

    sysctl: share unsigned long const values
    
    [ Upstream commit b1f2aff888af54a057c2c3c0d88a13ef5d37b52a ]
    
    Provide a way to share unsigned long values.  This will allow others to
    not have to re-invent these values.
    
    Link: https://lkml.kernel.org/r/20211124231435.1445213-9-mcgrof@xxxxxxxxxx
    Signed-off-by: Luis Chamberlain <mcgrof@xxxxxxxxxx>
    Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
    Cc: Amir Goldstein <amir73il@xxxxxxxxx>
    Cc: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
    Cc: Antti Palosaari <crope@xxxxxx>
    Cc: Arnd Bergmann <arnd@xxxxxxxx>
    Cc: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>
    Cc: Benjamin LaHaise <bcrl@xxxxxxxxx>
    Cc: Clemens Ladisch <clemens@xxxxxxxxxx>
    Cc: David Airlie <airlied@xxxxxxxx>
    Cc: Douglas Gilbert <dgilbert@xxxxxxxxxxxx>
    Cc: Eric Biederman <ebiederm@xxxxxxxxxxxx>
    Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Cc: Iurii Zaikin <yzaikin@xxxxxxxxxx>
    Cc: James E.J. Bottomley <jejb@xxxxxxxxxxxxx>
    Cc: Jani Nikula <jani.nikula@xxxxxxxxx>
    Cc: Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx>
    Cc: Jan Kara <jack@xxxxxxx>
    Cc: Joel Becker <jlbec@xxxxxxxxxxxx>
    Cc: John Ogness <john.ogness@xxxxxxxxxxxxx>
    Cc: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>
    Cc: Joseph Qi <joseph.qi@xxxxxxxxxxxxxxxxx>
    Cc: Julia Lawall <julia.lawall@xxxxxxxx>
    Cc: Kees Cook <keescook@xxxxxxxxxxxx>
    Cc: Lukas Middendorf <kernel@xxxxxxxxxxx>
    Cc: Mark Fasheh <mark@xxxxxxxxxx>
    Cc: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
    Cc: Paul Turner <pjt@xxxxxxxxxx>
    Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
    Cc: Petr Mladek <pmladek@xxxxxxxx>
    Cc: Phillip Potter <phil@xxxxxxxxxxxxxxxx>
    Cc: Qing Wang <wangqing@xxxxxxxx>
    Cc: "Rafael J. Wysocki" <rafael@xxxxxxxxxx>
    Cc: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>
    Cc: Sebastian Reichel <sre@xxxxxxxxxx>
    Cc: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>
    Cc: Stephen Kitt <steve@xxxxxxx>
    Cc: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
    Cc: Suren Baghdasaryan <surenb@xxxxxxxxxx>
    Cc: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
    Cc: "Theodore Ts'o" <tytso@xxxxxxx>
    Cc: Xiaoming Ni <nixiaoming@xxxxxxxxxx>
    Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
    Stable-dep-of: d727935cad9f ("fs: fix proc_handler for sysctl_nr_open")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 213ea008fe2db..7c5d472b193f8 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -29,6 +29,9 @@ static const struct inode_operations proc_sys_dir_operations;
 const int sysctl_vals[] = { -1, 0, 1, 2, 4, 100, 200, 1000, 3000, INT_MAX };
 EXPORT_SYMBOL(sysctl_vals);
 
+const unsigned long sysctl_long_vals[] = { 0, 1, LONG_MAX };
+EXPORT_SYMBOL_GPL(sysctl_long_vals);
+
 /* Support for permanently empty directories */
 
 struct ctl_table sysctl_mount_point[] = {
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 32d79ef906e51..3fa5e2713aace 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -51,6 +51,12 @@ struct ctl_dir;
 
 extern const int sysctl_vals[];
 
+#define SYSCTL_LONG_ZERO	((void *)&sysctl_long_vals[0])
+#define SYSCTL_LONG_ONE		((void *)&sysctl_long_vals[1])
+#define SYSCTL_LONG_MAX		((void *)&sysctl_long_vals[2])
+
+extern const unsigned long sysctl_long_vals[];
+
 typedef int proc_handler(struct ctl_table *ctl, int write, void *buffer,
 		size_t *lenp, loff_t *ppos);
 
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 48eb4e7b72dea..05853e7681512 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -113,9 +113,6 @@
 static int sixty = 60;
 #endif
 
-static const unsigned long zero_ul;
-static const unsigned long one_ul = 1;
-static const unsigned long long_max = LONG_MAX;
 #ifdef CONFIG_PRINTK
 static const int ten_thousand = 10000;
 #endif
@@ -2726,7 +2723,7 @@ static struct ctl_table vm_table[] = {
 		.maxlen		= sizeof(dirty_background_bytes),
 		.mode		= 0644,
 		.proc_handler	= dirty_background_bytes_handler,
-		.extra1		= (void *)&one_ul,
+		.extra1		= SYSCTL_LONG_ONE,
 	},
 	{
 		.procname	= "dirty_ratio",
@@ -3146,8 +3143,8 @@ static struct ctl_table fs_table[] = {
 		.maxlen		= sizeof(files_stat.max_files),
 		.mode		= 0644,
 		.proc_handler	= proc_doulongvec_minmax,
-		.extra1		= (void *)&zero_ul,
-		.extra2		= (void *)&long_max,
+		.extra1		= SYSCTL_LONG_ZERO,
+		.extra2		= SYSCTL_LONG_MAX,
 	},
 	{
 		.procname	= "nr_open",




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux