From: kernel test robot <lkp@intel.com>
To: Jori Koolstra <jkoolstra@xs4all.nl>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
Christian Brauner <christianvanbrauner@gmail.com>,
Christian Brauner <brauner@kernel.org>
Subject: [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
Date: Sun, 07 Jun 2026 10:49:04 +0800 [thread overview]
Message-ID: <202606071029.DKCs8WOs-lkp@intel.com> (raw)
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
next reply other threads:[~2026-06-07 2:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-07 2:49 kernel test robot [this message]
2026-06-07 4:14 ` [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 Nathan Chancellor
2026-06-07 10:07 ` Jeff Layton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202606071029.DKCs8WOs-lkp@intel.com \
--to=lkp@intel.com \
--cc=brauner@kernel.org \
--cc=christianvanbrauner@gmail.com \
--cc=jkoolstra@xs4all.nl \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox