Re: [PATCH] scsi: libsas: Add __printf attribute to sas_ata_printk()

From: John Garry

Date: Wed Oct 21 2026 - 05:01:37 EST


On 10/20/26 20:59, Adrián García Casado wrote:
sas_ata_printk() formats its variadic arguments via struct va_format and
%pV before passing them to printk().

Because %pV hides the format string from the compiler, GCC does not suggest
the format attribute under -Wsuggest-attribute=format, and callers do not
get compile-time format string validation.

Add the __printf(3, 4) attribute to sas_ata_printk() to enable compile-time
format string checking for its callers.

Signed-off-by: Adrián García Casado <adriangarciacasado42@xxxxxxxxx>
---
drivers/scsi/libsas/sas_ata.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index 61368e55bf..53eac56c3a 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -372,6 +372,7 @@ static int local_ata_check_ready(struct ata_link *link)
}
}

I checked https://gcc.gnu.org/onlinedocs/gcc/Common-Attributes.html#Common-Function-Attributes format section, and this looks sane, so:
Reviewed-by: John Garry <john.garry@xxxxxxxxx>


+__printf(3, 4)
static int sas_ata_printk(const char *level, const struct domain_device *ddev,
const char *fmt, ...)
{