mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] xfs: add __printf attribute to xfs_buf_alert_ratelimited()
@ 2026-10-20 19:56 Adrián García Casado
  2026-10-21  9:36 ` Carlos Maiolino
  0 siblings, 1 reply; 2+ messages in thread
From: Adrián García Casado @ 2026-10-20 19:56 UTC (permalink / raw)
  To: Carlos Maiolino
  Cc: Darrick J . Wong, linux-xfs, linux-kernel,
	Adrián García Casado

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@gmail.com>
---
 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, ...);
 
-- 
2.39.5


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] xfs: add __printf attribute to xfs_buf_alert_ratelimited()
  2026-10-20 19:56 [PATCH] xfs: add __printf attribute to xfs_buf_alert_ratelimited() Adrián García Casado
@ 2026-10-21  9:36 ` Carlos Maiolino
  0 siblings, 0 replies; 2+ messages in thread
From: Carlos Maiolino @ 2026-10-21  9:36 UTC (permalink / raw)
  To: Adrián García Casado; +Cc: Darrick J . Wong, linux-xfs, linux-kernel

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@gmail.com>
> ---
>  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@redhat.com>

> -- 
> 2.39.5
> 
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-21  9:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-20 19:56 [PATCH] xfs: add __printf attribute to xfs_buf_alert_ratelimited() Adrián García Casado
2026-10-21  9:36 ` Carlos Maiolino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®