Re: [PATCH v2] fs: fix undefined behavior in bit shift for SB_NOUSER

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

 



On Mon, Oct 31, 2022 at 09:48:11PM +0800, Gaosheng Cui wrote:
> +++ b/include/linux/fs.h
> @@ -1384,19 +1384,19 @@ extern int send_sigurg(struct fown_struct *fown);
>  #define SB_NOATIME	1024	/* Do not update access times. */
>  #define SB_NODIRATIME	2048	/* Do not update directory access times */
>  #define SB_SILENT	32768

Shouldn't those ^^^ also be marked as unsigned?  And it's confusing to
have the style change halfway through the sequence; can you convert them
to (1U << n) as well?

> -#define SB_POSIXACL	(1<<16)	/* VFS does not apply the umask */
> -#define SB_INLINECRYPT	(1<<17)	/* Use blk-crypto for encrypted files */
> -#define SB_KERNMOUNT	(1<<22) /* this is a kern_mount call */
> -#define SB_I_VERSION	(1<<23) /* Update inode I_version field */
> -#define SB_LAZYTIME	(1<<25) /* Update the on-disk [acm]times lazily */
> +#define SB_POSIXACL	(1U << 16) /* VFS does not apply the umask */
> +#define SB_INLINECRYPT	(1U << 17) /* Use blk-crypto for encrypted files */
> +#define SB_KERNMOUNT	(1U << 22) /* this is a kern_mount call */
> +#define SB_I_VERSION	(1U << 23) /* Update inode I_version field */
> +#define SB_LAZYTIME	(1U << 25) /* Update the on-disk [acm]times lazily */
>  
>  /* These sb flags are internal to the kernel */
> -#define SB_SUBMOUNT     (1<<26)
> -#define SB_FORCE    	(1<<27)
> -#define SB_NOSEC	(1<<28)
> -#define SB_BORN		(1<<29)
> -#define SB_ACTIVE	(1<<30)
> -#define SB_NOUSER	(1<<31)
> +#define SB_SUBMOUNT	(1U << 26)
> +#define SB_FORCE	(1U << 27)
> +#define SB_NOSEC	(1U << 28)
> +#define SB_BORN		(1U << 29)
> +#define SB_ACTIVE	(1U << 30)
> +#define SB_NOUSER	(1U << 31)
>  
>  /* These flags relate to encoding and casefolding */
>  #define SB_ENC_STRICT_MODE_FL	(1 << 0)
> -- 
> 2.25.1
> 



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux