Re: [PATCH] xfs: add __printf attribute to xfs_buf_alert_ratelimited()

From: Carlos Maiolino

Date: Wed Oct 21 2026 - 05:39:30 EST


On Tue, Oct 20, 2026 at 09:56:28PM +0200, Adrián García Casado wrote:
> xfs_printk_level() and _xfs_alert_tag() in fs/xfs/xfs_message.h are
> annotated with __printf(3, 4), but xfs_buf_alert_ratelimited() in the
> same header is missing the attribute.
>
> Because xfs_buf_alert_ratelimited() formats its variadic arguments via
> struct va_format and %pV, the compiler does not suggest the format
> attribute under -Wsuggest-attribute=format, and callers do not get
> compile-time format string checking.
>
> Add __printf(3, 4) to xfs_buf_alert_ratelimited() to match the other
> logging helpers in fs/xfs/xfs_message.h.
>
> Signed-off-by: Adrián García Casado <adriangarciacasado42@xxxxxxxxx>
> ---
> fs/xfs/xfs_message.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/xfs/xfs_message.h b/fs/xfs/xfs_message.h
> index 811b885f41..bfae8dddc9 100644
> --- a/fs/xfs/xfs_message.h
> +++ b/fs/xfs/xfs_message.h
> @@ -87,6 +87,7 @@ void asswarn(struct xfs_mount *mp, char *expr, char *f, int l);
>
> extern void xfs_hex_dump(const void *p, int length);
>
> +__printf(3, 4)
> void xfs_buf_alert_ratelimited(struct xfs_buf *bp, const char *rlmsg,
> const char *fmt, ...);
>

Seems reasonable.

Reviewed-by: Carlos Maiolino <cmaiolino@xxxxxxxxxx>

> --
> 2.39.5
>
>