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]
Message-ID: <f37d02a675208bebc7025443e6cd74da.paul@paul-moore.com>
Date:   Thu, 03 Aug 2023 22:20:22 -0400
From:   Paul Moore <paul@...l-moore.com>
To:     Christian Göttsche <cgzones@...glemail.com>,
        selinux@...r.kernel.org
Cc:     Stephen Smalley <stephen.smalley.work@...il.com>,
        Eric Paris <eparis@...isplace.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 7/9] selinux: avoid implicit conversions in selinuxfs  code

On Jul 28, 2023 =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@...glemail.com> wrote:
> 
> Use umode_t as parameter type for sel_make_inode(), which assigns the
> value to the member i_mode of struct inode.
> 
> Use identical type for loop iterator.
> 
> Signed-off-by: Christian Göttsche <cgzones@...glemail.com>
> ---
> v2: avoid declarations in init-clauses of for loops
> ---
>  security/selinux/selinuxfs.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
> index b969e87fd870..7d7931d1758e 100644
> --- a/security/selinux/selinuxfs.c
> +++ b/security/selinux/selinuxfs.c

...

> @@ -1623,7 +1622,7 @@ static int sel_make_avc_files(struct dentry *dir)
>  #endif
>  	};
>  
> -	for (i = 0; i < ARRAY_SIZE(files); i++) {
> +	for (u32 i = 0; i < ARRAY_SIZE(files); i++) {

No initializers in the for-loop ;)

Also, how did you decide 'i' should be a u32?

>  		struct inode *inode;
>  		struct dentry *dentry;
>  
> @@ -1649,7 +1648,7 @@ static int sel_make_ss_files(struct dentry *dir)
>  {
>  	struct super_block *sb = dir->d_sb;
>  	struct selinux_fs_info *fsi = sb->s_fs_info;
> -	int i;
> +	u32 i;

Same as above, why u32?

>  	static const struct tree_descr files[] = {
>  		{ "sidtab_hash_stats", &sel_sidtab_hash_stats_ops, S_IRUGO },
>  	};
> @@ -1700,7 +1699,7 @@ static const struct file_operations sel_initcon_ops = {
>  
>  static int sel_make_initcon_files(struct dentry *dir)
>  {
> -	int i;
> +	u32 i;

Again, why u32?

>  	for (i = 1; i <= SECINITSID_NUM; i++) {
>  		struct inode *inode;
> -- 
> 2.40.1

--
paul-moore.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ