lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 20 Mar 2024 11:36:03 +0100
From: Jan Kara <jack@...e.cz>
To: wenyang.linux@...mail.com
Cc: "Eric W . Biederman" <ebiederm@...ssion.com>,
	Luis Chamberlain <mcgrof@...nel.org>,
	Kees Cook <keescook@...omium.org>,
	Joel Granados <j.granados@...sung.com>,
	Christian Brauner <brauner@...nel.org>,
	Dave Young <dyoung@...hat.com>, Jan Kara <jack@...e.cz>,
	"Darrick J. Wong" <djwong@...nel.org>, linux-kernel@...r.kernel.org
Subject: Re: [RESEND PATCH v2 8/9] fs: inotify: delete these unnecessary
 static variables it_zero and it_int_max

On Tue 19-03-24 23:57:49, wenyang.linux@...mail.com wrote:
> From: Wen Yang <wenyang.linux@...mail.com>
> 
> Delete unnecessary static variables (it_zero and it_int_max)
> and encode them directly in the table entry.
> 
> Signed-off-by: Wen Yang <wenyang.linux@...mail.com>
> Cc: Eric W. Biederman <ebiederm@...ssion.com>
> Cc: Luis Chamberlain <mcgrof@...nel.org>
> Cc: Kees Cook <keescook@...omium.org>
> Cc: Joel Granados <j.granados@...sung.com>
> Cc: Christian Brauner <brauner@...nel.org>
> Cc: Jan Kara <jack@...e.cz>
> Cc: "Darrick J. Wong" <djwong@...nel.org>
> Cc: linux-kernel@...r.kernel.org

This looks as a sensible cleanup but I don't see the first patch in the
series (and neither it is archived at lore.kernel.org) so I cannot really
verify whether your conversion is correct...

								Honza

> ---
>  fs/notify/inotify/inotify_user.c | 49 +++++++++++++-------------------
>  1 file changed, 20 insertions(+), 29 deletions(-)
> 
> diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
> index 85d8fdd55329..b346d61179ea 100644
> --- a/fs/notify/inotify/inotify_user.c
> +++ b/fs/notify/inotify/inotify_user.c
> @@ -55,36 +55,27 @@ struct kmem_cache *inotify_inode_mark_cachep __ro_after_init;
>  
>  #include <linux/sysctl.h>
>  
> -static long it_zero = 0;
> -static long it_int_max = INT_MAX;
> -
>  static struct ctl_table inotify_table[] = {
> -	{
> -		.procname	= "max_user_instances",
> -		.data		= &init_user_ns.ucount_max[UCOUNT_INOTIFY_INSTANCES],
> -		.maxlen		= sizeof(long),
> -		.mode		= 0644,
> -		.proc_handler	= proc_doulongvec_minmax,
> -		.extra1		= &it_zero,
> -		.extra2		= &it_int_max,
> -	},
> -	{
> -		.procname	= "max_user_watches",
> -		.data		= &init_user_ns.ucount_max[UCOUNT_INOTIFY_WATCHES],
> -		.maxlen		= sizeof(long),
> -		.mode		= 0644,
> -		.proc_handler	= proc_doulongvec_minmax,
> -		.extra1		= &it_zero,
> -		.extra2		= &it_int_max,
> -	},
> -	{
> -		.procname	= "max_queued_events",
> -		.data		= &inotify_max_queued_events,
> -		.maxlen		= sizeof(int),
> -		.mode		= 0644,
> -		.proc_handler	= proc_dointvec_minmax,
> -		.extra1		= SYSCTL_ZERO
> -	},
> +	CTL_TABLE_ENTRY_MINMAX("max_user_instances",
> +			       &init_user_ns.ucount_max[UCOUNT_INOTIFY_INSTANCES],
> +			       sizeof(long),
> +			       0644,
> +			       proc_doulongvec_minmax,
> +			       SYSCTL_NUMERIC_ZERO,
> +			       SYSCTL_NUMERIC_INT_MAX),
> +	CTL_TABLE_ENTRY_MINMAX("max_user_watches",
> +			       &init_user_ns.ucount_max[UCOUNT_INOTIFY_WATCHES],
> +			       sizeof(long),
> +			       0644,
> +			       proc_doulongvec_minmax,
> +			       SYSCTL_NUMERIC_ZERO,
> +			       SYSCTL_NUMERIC_INT_MAX),
> +	CTL_TABLE_ENTRY_MIN("max_queued_events",
> +			    &inotify_max_queued_events,
> +			    sizeof(int),
> +			    0644,
> +			    proc_dointvec_minmax,
> +			    SYSCTL_NUMERIC_ZERO),
>  };
>  
>  static void __init inotify_sysctls_init(void)
> -- 
> 2.25.1
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ