]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
filelock: fix break_lease() stub signature for CONFIG_FILE_LOCKING=n
authorChristian Brauner <brauner@kernel.org>
Sun, 7 Jun 2026 09:40:28 +0000 (11:40 +0200)
committerChristian Brauner <brauner@kernel.org>
Sun, 7 Jun 2026 09:40:28 +0000 (11:40 +0200)
The CONFIG_FILE_LOCKING=n stub for break_lease() takes a 'bool wait'
argument, whereas the CONFIG_FILE_LOCKING=y version and every caller pass
an openmode as an 'unsigned int mode'. The mismatch was introduced when
__break_lease() was reworked to use flags: only the stub was switched to
'bool wait', a stray leftover from the neighbouring break_layout()
helper. The real prototype kept 'unsigned int mode'.

This was harmless until O_WRONLY changed from the octal literal 00000001
to (1 << 0). clang's -Wtautological-constant-compare then fires on the
implicit shift-to-bool conversion at the first FILE_LOCKING=n caller:

  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);

Restore the stub's parameter to 'unsigned int mode' so it matches the
real prototype and every caller. The stub still just returns 0, so there
is no functional change; it removes the type inconsistency and silences
the warning.

Root cause diagnosed by Nathan Chancellor.

Fixes: 4be9f3cc582a ("filelock: rework the __break_lease API to use flags")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202606071029.DKCs8WOs-lkp@intel.com/
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
include/linux/filelock.h

index 5f0a2fb31450607ae23d7f06b6372f4f63c1bf62..77e1cc4afbaa8930574a9374a0b245503bde8bcf 100644 (file)
@@ -564,7 +564,7 @@ static inline bool is_delegated(struct delegated_inode *di)
        return false;
 }
 
-static inline int break_lease(struct inode *inode, bool wait)
+static inline int break_lease(struct inode *inode, unsigned int mode)
 {
        return 0;
 }