* [brauner-github:vfs-7.2.misc 28/28] fs/open.c:112:29: warning: converting the result of '<<' to a boolean always evaluates to true
@ 2026-06-07 2:49 kernel test robot
2026-06-07 4:14 ` Nathan Chancellor
0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2026-06-07 2:49 UTC (permalink / raw)
To: Jori Koolstra; +Cc: llvm, oe-kbuild-all, Christian Brauner, Christian Brauner
Hi Jori,
FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.
tree: https://github.com/brauner/linux.git vfs-7.2.misc
head: 0da79c259ad0554b36761a7135d4f92eb7c46263
commit: 0da79c259ad0554b36761a7135d4f92eb7c46263 [28/28] vfs: uapi: retire octal and hex numbers in favor of (1 << n) for O_ flags
config: powerpc64-randconfig-001-20260607 (https://download.01.org/0day-ci/archive/20260607/202606071029.DKCs8WOs-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 7917772d7d61384696c61102c08c2ea158e610fa)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260607/202606071029.DKCs8WOs-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202606071029.DKCs8WOs-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> fs/open.c:112:29: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
112 | error = break_lease(inode, O_WRONLY);
| ^
include/uapi/asm-generic/fcntl.h:20:21: note: expanded from macro 'O_WRONLY'
20 | #define O_WRONLY (1 << 0)
| ^
fs/open.c:152:1: warning: alias and aliasee have different types 'long (const char *, long)' and 'long (typeof (__builtin_choose_expr((__builtin_types_compatible_p(typeof ((const char *)0), typeof (0LL)) || __builtin_types_compatible_p(typeof ((const char *)0), typeof (0ULL))), 0LL, 0L)), typeof (__builtin_choose_expr((__builtin_types_compatible_p(typeof ((long)0), typeof (0LL)) || __builtin_types_compatible_p(typeof ((long)0), typeof (0ULL))), 0LL, 0L)))' (aka 'long (long, long)') [-Wattribute-alias]
152 | SYSCALL_DEFINE2(truncate, const char __user *, path, long, length)
| ^
include/linux/syscalls.h:226:36: note: expanded from macro 'SYSCALL_DEFINE2'
226 | #define SYSCALL_DEFINE2(name, ...) SYSCALL_DEFINEx(2, _##name, __VA_ARGS__)
| ^
include/linux/syscalls.h:236:2: note: expanded from macro 'SYSCALL_DEFINEx'
236 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
| ^
include/linux/syscalls.h:251:18: note: expanded from macro '__SYSCALL_DEFINEx'
251 | __attribute__((alias(__stringify(__se_sys##name)))); \
| ^
fs/open.c:152:1: note: aliasee is declared here
include/linux/syscalls.h:226:36: note: expanded from macro 'SYSCALL_DEFINE2'
226 | #define SYSCALL_DEFINE2(name, ...) SYSCALL_DEFINEx(2, _##name, __VA_ARGS__)
| ^
include/linux/syscalls.h:236:2: note: expanded from macro 'SYSCALL_DEFINEx'
236 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
| ^
include/linux/syscalls.h:255:18: note: expanded from macro '__SYSCALL_DEFINEx'
255 | asmlinkage long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
| ^
<scratch space>:92:1: note: expanded from here
92 | __se_sys_truncate
| ^
fs/open.c:158:1: warning: alias and aliasee have different types 'long (const char *, compat_off_t)' (aka 'long (const char *, int)') and 'long (typeof (__builtin_choose_expr((__builtin_types_compatible_p(typeof ((const char *)0), typeof (0LL)) || __builtin_types_compatible_p(typeof ((const char *)0), typeof (0ULL))), 0LL, 0L)), typeof (__builtin_choose_expr((__builtin_types_compatible_p(typeof ((compat_off_t)0), typeof (0LL)) || __builtin_types_compatible_p(typeof ((compat_off_t)0), typeof (0ULL))), 0LL, 0L)))' (aka 'long (long, long)') [-Wattribute-alias]
158 | COMPAT_SYSCALL_DEFINE2(truncate, const char __user *, path, compat_off_t, length)
| ^
include/linux/compat.h:55:2: note: expanded from macro 'COMPAT_SYSCALL_DEFINE2'
55 | COMPAT_SYSCALL_DEFINEx(2, _##name, __VA_ARGS__)
| ^
include/linux/compat.h:76:18: note: expanded from macro 'COMPAT_SYSCALL_DEFINEx'
76 | __attribute__((alias(__stringify(__se_compat_sys##name)))); \
| ^
fs/open.c:158:1: note: aliasee is declared here
include/linux/compat.h:55:2: note: expanded from macro 'COMPAT_SYSCALL_DEFINE2'
55 | COMPAT_SYSCALL_DEFINEx(2, _##name, __VA_ARGS__)
| ^
include/linux/compat.h:80:18: note: expanded from macro 'COMPAT_SYSCALL_DEFINEx'
80 | asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
| ^
<scratch space>:119:1: note: expanded from here
119 | __se_compat_sys_truncate
| ^
fs/open.c:209:1: warning: alias and aliasee have different types 'long (unsigned int, off_t)' (aka 'long (unsigned int, long)') and 'long (typeof (__builtin_choose_expr((__builtin_types_compatible_p(typeof ((unsigned int)0), typeof (0LL)) || __builtin_types_compatible_p(typeof ((unsigned int)0), typeof (0ULL))), 0LL, 0L)), typeof (__builtin_choose_expr((__builtin_types_compatible_p(typeof ((off_t)0), typeof (0LL)) || __builtin_types_compatible_p(typeof ((off_t)0), typeof (0ULL))), 0LL, 0L)))' (aka 'long (long, long)') [-Wattribute-alias]
209 | SYSCALL_DEFINE2(ftruncate, unsigned int, fd, off_t, length)
| ^
include/linux/syscalls.h:226:36: note: expanded from macro 'SYSCALL_DEFINE2'
226 | #define SYSCALL_DEFINE2(name, ...) SYSCALL_DEFINEx(2, _##name, __VA_ARGS__)
| ^
include/linux/syscalls.h:236:2: note: expanded from macro 'SYSCALL_DEFINEx'
236 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
| ^
include/linux/syscalls.h:251:18: note: expanded from macro '__SYSCALL_DEFINEx'
251 | __attribute__((alias(__stringify(__se_sys##name)))); \
| ^
fs/open.c:209:1: note: aliasee is declared here
include/linux/syscalls.h:226:36: note: expanded from macro 'SYSCALL_DEFINE2'
226 | #define SYSCALL_DEFINE2(name, ...) SYSCALL_DEFINEx(2, _##name, __VA_ARGS__)
| ^
include/linux/syscalls.h:236:2: note: expanded from macro 'SYSCALL_DEFINEx'
236 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
| ^
include/linux/syscalls.h:255:18: note: expanded from macro '__SYSCALL_DEFINEx'
255 | asmlinkage long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
| ^
<scratch space>:165:1: note: expanded from here
165 | __se_sys_ftruncate
| ^
fs/open.c:215:1: warning: alias and aliasee have different types 'long (unsigned int, compat_off_t)' (aka 'long (unsigned int, int)') and 'long (typeof (__builtin_choose_expr((__builtin_types_compatible_p(typeof ((unsigned int)0), typeof (0LL)) || __builtin_types_compatible_p(typeof ((unsigned int)0), typeof (0ULL))), 0LL, 0L)), typeof (__builtin_choose_expr((__builtin_types_compatible_p(typeof ((compat_off_t)0), typeof (0LL)) || __builtin_types_compatible_p(typeof ((compat_off_t)0), typeof (0ULL))), 0LL, 0L)))' (aka 'long (long, long)') [-Wattribute-alias]
215 | COMPAT_SYSCALL_DEFINE2(ftruncate, unsigned int, fd, compat_off_t, length)
| ^
include/linux/compat.h:55:2: note: expanded from macro 'COMPAT_SYSCALL_DEFINE2'
55 | COMPAT_SYSCALL_DEFINEx(2, _##name, __VA_ARGS__)
| ^
include/linux/compat.h:76:18: note: expanded from macro 'COMPAT_SYSCALL_DEFINEx'
76 | __attribute__((alias(__stringify(__se_compat_sys##name)))); \
| ^
fs/open.c:215:1: note: aliasee is declared here
include/linux/compat.h:55:2: note: expanded from macro 'COMPAT_SYSCALL_DEFINE2'
55 | COMPAT_SYSCALL_DEFINEx(2, _##name, __VA_ARGS__)
| ^
include/linux/compat.h:80:18: note: expanded from macro 'COMPAT_SYSCALL_DEFINEx'
80 | asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
| ^
<scratch space>:192:1: note: expanded from here
192 | __se_compat_sys_ftruncate
| ^
fs/open.c:365:1: warning: alias and aliasee have different types 'long (int, int, loff_t, loff_t)' (aka 'long (int, int, long long, long long)') and 'long (typeof (__builtin_choose_expr((__builtin_types_compatible_p(typeof ((int)0), typeof (0LL)) || __builtin_types_compatible_p(typeof ((int)0), typeof (0ULL))), 0LL, 0L)), typeof (__builtin_choose_expr((__builtin_types_compatible_p(typeof ((int)0), typeof (0LL)) || __builtin_types_compatible_p(typeof ((int)0), typeof (0ULL))), 0LL, 0L)), typeof (__builtin_choose_expr((__builtin_types_compatible_p(typeof ((loff_t)0), typeof (0LL)) || __builtin_types_compatible_p(typeof ((loff_t)0), typeof (0ULL))), 0LL, 0L)), typeof (__builtin_choose_expr((__builtin_types_compatible_p(typeof ((loff_t)0), typeof (0LL)) || __builtin_types_compatible_p(typeof ((loff_t)0), typeof (0ULL))), 0LL, 0L)))' (aka 'long (long, long, long long, long long)') [-Wattribute-alias]
365 | SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len)
| ^
include/linux/syscalls.h:228:36: note: expanded from macro 'SYSCALL_DEFINE4'
228 | #define SYSCALL_DEFINE4(name, ...) SYSCALL_DEFINEx(4, _##name, __VA_ARGS__)
| ^
include/linux/syscalls.h:236:2: note: expanded from macro 'SYSCALL_DEFINEx'
vim +112 fs/open.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 72
29d80d506b1838 Yuichiro Tsuji 2025-01-21 73 int vfs_truncate(const struct path *path, loff_t length)
^1da177e4c3f41 Linus Torvalds 2005-04-16 74 {
abf08576afe315 Christian Brauner 2023-01-13 75 struct mnt_idmap *idmap;
^1da177e4c3f41 Linus Torvalds 2005-04-16 76 struct inode *inode;
29d80d506b1838 Yuichiro Tsuji 2025-01-21 77 int error;
^1da177e4c3f41 Linus Torvalds 2005-04-16 78
a02de9608595c8 David Howells 2012-12-20 79 inode = path->dentry->d_inode;
^1da177e4c3f41 Linus Torvalds 2005-04-16 80
^1da177e4c3f41 Linus Torvalds 2005-04-16 81 /* For directories it's -EISDIR, for other non-regulars - -EINVAL */
^1da177e4c3f41 Linus Torvalds 2005-04-16 82 if (S_ISDIR(inode->i_mode))
a02de9608595c8 David Howells 2012-12-20 83 return -EISDIR;
^1da177e4c3f41 Linus Torvalds 2005-04-16 84 if (!S_ISREG(inode->i_mode))
a02de9608595c8 David Howells 2012-12-20 85 return -EINVAL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 86
abf08576afe315 Christian Brauner 2023-01-13 87 idmap = mnt_idmap(path->mnt);
4609e1f18e19c3 Christian Brauner 2023-01-13 88 error = inode_permission(idmap, inode, MAY_WRITE);
9ac9b8474c39c3 Dave Hansen 2008-02-15 89 if (error)
4acf3bc76e521b Amir Goldstein 2024-11-15 90 return error;
4acf3bc76e521b Amir Goldstein 2024-11-15 91
4acf3bc76e521b Amir Goldstein 2024-11-15 92 error = fsnotify_truncate_perm(path, length);
4acf3bc76e521b Amir Goldstein 2024-11-15 93 if (error)
4acf3bc76e521b Amir Goldstein 2024-11-15 94 return error;
4acf3bc76e521b Amir Goldstein 2024-11-15 95
4acf3bc76e521b Amir Goldstein 2024-11-15 96 error = mnt_want_write(path->mnt);
4acf3bc76e521b Amir Goldstein 2024-11-15 97 if (error)
4acf3bc76e521b Amir Goldstein 2024-11-15 98 return error;
^1da177e4c3f41 Linus Torvalds 2005-04-16 99
^1da177e4c3f41 Linus Torvalds 2005-04-16 100 error = -EPERM;
c82e42da8a6b2f Miklos Szeredi 2008-06-24 101 if (IS_APPEND(inode))
9ac9b8474c39c3 Dave Hansen 2008-02-15 102 goto mnt_drop_write_and_out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 103
8cf9ee5061037a Miklos Szeredi 2018-07-18 104 error = get_write_access(inode);
^1da177e4c3f41 Linus Torvalds 2005-04-16 105 if (error)
9ac9b8474c39c3 Dave Hansen 2008-02-15 106 goto mnt_drop_write_and_out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 107
9700382c3c9ff3 david m. richter 2007-07-31 108 /*
9700382c3c9ff3 david m. richter 2007-07-31 109 * Make sure that there are no leases. get_write_access() protects
9700382c3c9ff3 david m. richter 2007-07-31 110 * against the truncate racing with a lease-granting setlease().
9700382c3c9ff3 david m. richter 2007-07-31 111 */
8737c9305bd560 Al Viro 2009-12-24 @112 error = break_lease(inode, O_WRONLY);
^1da177e4c3f41 Linus Torvalds 2005-04-16 113 if (error)
9700382c3c9ff3 david m. richter 2007-07-31 114 goto put_write_and_out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 115
a02de9608595c8 David Howells 2012-12-20 116 error = security_path_truncate(path);
907f4554e2521c Christoph Hellwig 2010-03-03 117 if (!error)
abf08576afe315 Christian Brauner 2023-01-13 118 error = do_truncate(idmap, path->dentry, length, 0, NULL);
^1da177e4c3f41 Linus Torvalds 2005-04-16 119
9700382c3c9ff3 david m. richter 2007-07-31 120 put_write_and_out:
8cf9ee5061037a Miklos Szeredi 2018-07-18 121 put_write_access(inode);
9ac9b8474c39c3 Dave Hansen 2008-02-15 122 mnt_drop_write_and_out:
a02de9608595c8 David Howells 2012-12-20 123 mnt_drop_write(path->mnt);
4acf3bc76e521b Amir Goldstein 2024-11-15 124
^1da177e4c3f41 Linus Torvalds 2005-04-16 125 return error;
^1da177e4c3f41 Linus Torvalds 2005-04-16 126 }
a02de9608595c8 David Howells 2012-12-20 127 EXPORT_SYMBOL_GPL(vfs_truncate);
a02de9608595c8 David Howells 2012-12-20 128
:::::: The code at line 112 was first introduced by commit
:::::: 8737c9305bd5602b11f7eb4655d5695d4a42a0c6 Switch may_open() and break_lease() to passing O_...
:::::: TO: Al Viro <viro@zeniv.linux.org.uk>
:::::: CC: Al Viro <viro@zeniv.linux.org.uk>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [brauner-github:vfs-7.2.misc 28/28] fs/open.c:112:29: warning: converting the result of '<<' to a boolean always evaluates to true
2026-06-07 2:49 [brauner-github:vfs-7.2.misc 28/28] fs/open.c:112:29: warning: converting the result of '<<' to a boolean always evaluates to true kernel test robot
@ 2026-06-07 4:14 ` Nathan Chancellor
2026-06-07 10:07 ` Jeff Layton
0 siblings, 1 reply; 3+ messages in thread
From: Nathan Chancellor @ 2026-06-07 4:14 UTC (permalink / raw)
To: kernel test robot
Cc: Jori Koolstra, llvm, oe-kbuild-all, Christian Brauner,
Christian Brauner, Jeff Layton
On Sun, Jun 07, 2026 at 10:49:04AM +0800, kernel test robot wrote:
> Hi Jori,
>
> FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.
>
> tree: https://github.com/brauner/linux.git vfs-7.2.misc
> head: 0da79c259ad0554b36761a7135d4f92eb7c46263
> commit: 0da79c259ad0554b36761a7135d4f92eb7c46263 [28/28] vfs: uapi: retire octal and hex numbers in favor of (1 << n) for O_ flags
> config: powerpc64-randconfig-001-20260607 (https://download.01.org/0day-ci/archive/20260607/202606071029.DKCs8WOs-lkp@intel.com/config)
> compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 7917772d7d61384696c61102c08c2ea158e610fa)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260607/202606071029.DKCs8WOs-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202606071029.DKCs8WOs-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
> >> fs/open.c:112:29: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
> 112 | error = break_lease(inode, O_WRONLY);
> | ^
> include/uapi/asm-generic/fcntl.h:20:21: note: expanded from macro 'O_WRONLY'
> 20 | #define O_WRONLY (1 << 0)
> | ^
Hmmm, this appears to be pointing out an inconsistency between the
different versions of break_lease(), depending on whether
CONFIG_FILE_LOCKING is set or not. The CONFIG_FILE_LOCKING=n stub has a
second parameter of 'bool wait' whereas the CONFIG_FILE_LOCKING=y case
has a second parameter of 'unsigned int mode'. 4be9f3cc582a ("filelock:
rework the __break_lease API to use flags") changed this, which seems
incorrect to me.
--
Cheers,
Nathan
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [brauner-github:vfs-7.2.misc 28/28] fs/open.c:112:29: warning: converting the result of '<<' to a boolean always evaluates to true
2026-06-07 4:14 ` Nathan Chancellor
@ 2026-06-07 10:07 ` Jeff Layton
0 siblings, 0 replies; 3+ messages in thread
From: Jeff Layton @ 2026-06-07 10:07 UTC (permalink / raw)
To: Nathan Chancellor, kernel test robot
Cc: Jori Koolstra, llvm, oe-kbuild-all, Christian Brauner,
Christian Brauner
On Sat, 2026-06-06 at 21:14 -0700, Nathan Chancellor wrote:
> On Sun, Jun 07, 2026 at 10:49:04AM +0800, kernel test robot wrote:
> > Hi Jori,
> >
> > FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.
> >
> > tree: https://github.com/brauner/linux.git vfs-7.2.misc
> > head: 0da79c259ad0554b36761a7135d4f92eb7c46263
> > commit: 0da79c259ad0554b36761a7135d4f92eb7c46263 [28/28] vfs: uapi: retire octal and hex numbers in favor of (1 << n) for O_ flags
> > config: powerpc64-randconfig-001-20260607 (https://download.01.org/0day-ci/archive/20260607/202606071029.DKCs8WOs-lkp@intel.com/config)
> > compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 7917772d7d61384696c61102c08c2ea158e610fa)
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260607/202606071029.DKCs8WOs-lkp@intel.com/reproduce)
> >
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > > Reported-by: kernel test robot <lkp@intel.com>
> > > Closes: https://lore.kernel.org/oe-kbuild-all/202606071029.DKCs8WOs-lkp@intel.com/
> >
> > All warnings (new ones prefixed by >>):
> >
> > > > fs/open.c:112:29: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
> > 112 | error = break_lease(inode, O_WRONLY);
> > | ^
> > include/uapi/asm-generic/fcntl.h:20:21: note: expanded from macro 'O_WRONLY'
> > 20 | #define O_WRONLY (1 << 0)
> > | ^
>
> Hmmm, this appears to be pointing out an inconsistency between the
> different versions of break_lease(), depending on whether
> CONFIG_FILE_LOCKING is set or not. The CONFIG_FILE_LOCKING=n stub has a
> second parameter of 'bool wait' whereas the CONFIG_FILE_LOCKING=y case
> has a second parameter of 'unsigned int mode'. 4be9f3cc582a ("filelock:
> rework the __break_lease API to use flags") changed this, which seems
> incorrect to me.
Good catch. I missed updating the stub when CONFIG_FILE_LOCKING=n. I'll
send Christian a follow-on patch to fix that.
Maybe this is another sign that we should just kill CONFIG_FILE_LOCKING
and just always enable it? It's not like it increases the size of the
binary much, and I imagine only the tiniest embedded systems disable
it.
Thanks,
--
Jeff Layton <jlayton@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-07 10:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-07 2:49 [brauner-github:vfs-7.2.misc 28/28] fs/open.c:112:29: warning: converting the result of '<<' to a boolean always evaluates to true kernel test robot
2026-06-07 4:14 ` Nathan Chancellor
2026-06-07 10:07 ` Jeff Layton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox