* [PATCH] scsi: libsas: Add __printf attribute to sas_ata_printk()
@ 2026-10-20 19:59 Adrián García Casado
2026-10-21 8:56 ` John Garry
0 siblings, 1 reply; 2+ messages in thread
From: Adrián García Casado @ 2026-10-20 19:59 UTC (permalink / raw)
To: Martin K . Petersen, James E . J . Bottomley
Cc: John Garry, Jason Yan, linux-scsi, linux-kernel,
Adrián García Casado
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@gmail.com>
---
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)
}
}
+__printf(3, 4)
static int sas_ata_printk(const char *level, const struct domain_device *ddev,
const char *fmt, ...)
{
--
2.39.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] scsi: libsas: Add __printf attribute to sas_ata_printk()
2026-10-20 19:59 [PATCH] scsi: libsas: Add __printf attribute to sas_ata_printk() Adrián García Casado
@ 2026-10-21 8:56 ` John Garry
0 siblings, 0 replies; 2+ messages in thread
From: John Garry @ 2026-10-21 8:56 UTC (permalink / raw)
To: Adrián García Casado, Martin K . Petersen,
James E . J . Bottomley
Cc: John Garry, Jason Yan, linux-scsi, linux-kernel
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@gmail.com>
> ---
> 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@linux.dev>
>
> +__printf(3, 4)
> static int sas_ata_printk(const char *level, const struct domain_device *ddev,
> const char *fmt, ...)
> {
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-21 8:56 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:59 [PATCH] scsi: libsas: Add __printf attribute to sas_ata_printk() Adrián García Casado
2026-10-21 8:56 ` John Garry
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®