[PATCH] btrfs: add __printf and __cold attributes to do_abort_log_replay()
From: Adrián García Casado
Date: Tue Oct 20 2026 - 15:50:16 EST
do_abort_log_replay() formats its variadic arguments via struct va_format
and %pV, and is only called in error paths when aborting log replay via
the btrfs_abort_log_replay() macro.
Because %pV hides the format string from the compiler, GCC does not warn
about the missing format attribute under -Wsuggest-attribute=format, and
callers do not get compile-time format string validation.
Add the __printf(5, 6) and __cold attributes to do_abort_log_replay(),
matching __btrfs_handle_fs_error() and __btrfs_panic().
Signed-off-by: Adrián García Casado <adriangarciacasado42@xxxxxxxxx>
---
fs/btrfs/tree-log.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index a00094604e..5ecc585061 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -158,6 +158,7 @@ struct walk_control {
struct btrfs_path *subvol_path;
};
+__printf(5, 6) __cold
static void do_abort_log_replay(struct walk_control *wc, const char *function,
unsigned int line, int error, const char *fmt, ...)
{
--
2.39.5