drivers/xen/xenbus/xenbus_client.c | 2 ++ 1 file changed, 2 insertions(+)
From: Peng Jiang <jiang.peng9@zte.com.cn>
This patch fixes a W=1 format-string warning reported by GCC 12.3.0
by annotating xenbus_switch_fatal() and xenbus_va_dev_error()
with the __printf attribute. The attribute enables compile-time
validation of printf-style format strings in these functions.
The original warning trace:
drivers/xen/xenbus/xenbus_client.c:304:9: warning: function 'xenbus_va_dev_error' might be
a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
Signed-off-by: Peng Jiang <jiang.peng9@zte.com.cn>
---
drivers/xen/xenbus/xenbus_client.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c
index 51b3124b0d56..e73ec225d4a6 100644
--- a/drivers/xen/xenbus/xenbus_client.c
+++ b/drivers/xen/xenbus/xenbus_client.c
@@ -202,6 +202,7 @@ int xenbus_watch_pathfmt(struct xenbus_device *dev,
}
EXPORT_SYMBOL_GPL(xenbus_watch_pathfmt);
+__printf(4, 5)
static void xenbus_switch_fatal(struct xenbus_device *, int, int,
const char *, ...);
@@ -287,6 +288,7 @@ int xenbus_frontend_closed(struct xenbus_device *dev)
}
EXPORT_SYMBOL_GPL(xenbus_frontend_closed);
+__printf(3, 0)
static void xenbus_va_dev_error(struct xenbus_device *dev, int err,
const char *fmt, va_list ap)
{
--
2.25.1
On 18.06.25 04:01, jiang.peng9@zte.com.cn wrote: > From: Peng Jiang <jiang.peng9@zte.com.cn> > > > This patch fixes a W=1 format-string warning reported by GCC 12.3.0 > > by annotating xenbus_switch_fatal() and xenbus_va_dev_error() > > with the __printf attribute. The attribute enables compile-time > > validation of printf-style format strings in these functions. > > > The original warning trace: > > drivers/xen/xenbus/xenbus_client.c:304:9: warning: function > 'xenbus_va_dev_error' might be > > a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format] > > > Signed-off-by: Peng Jiang <jiang.peng9@zte.com.cn> I'm fine with the changes as such, but please send the patch as a plain text email (no HTML). Otherwise I'm not able to apply it. You should look into Documentation/process/email-clients.rst in the kernel source tree. Juergen
From: Peng Jiang <jiang.peng9@zte.com.cn>
This patch fixes a W=1 format-string warning reported by GCC 12.3.0
by annotating xenbus_switch_fatal() and xenbus_va_dev_error()
with the __printf attribute. The attribute enables compile-time
validation of printf-style format strings in these functions.
The original warning trace:
drivers/xen/xenbus/xenbus_client.c:304:9: warning: function 'xenbus_va_dev_error' might be
a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
Signed-off-by: Peng Jiang <jiang.peng9@zte.com.cn>
---
drivers/xen/xenbus/xenbus_client.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c
index 51b3124b0d56..e73ec225d4a6 100644
--- a/drivers/xen/xenbus/xenbus_client.c
+++ b/drivers/xen/xenbus/xenbus_client.c
@@ -202,6 +202,7 @@ int xenbus_watch_pathfmt(struct xenbus_device *dev,
}
EXPORT_SYMBOL_GPL(xenbus_watch_pathfmt);
+__printf(4, 5)
static void xenbus_switch_fatal(struct xenbus_device *, int, int,
const char *, ...);
@@ -287,6 +288,7 @@ int xenbus_frontend_closed(struct xenbus_device *dev)
}
EXPORT_SYMBOL_GPL(xenbus_frontend_closed);
+__printf(3, 0)
static void xenbus_va_dev_error(struct xenbus_device *dev, int err,
const char *fmt, va_list ap)
{
--
2.25.1
On 20.06.25 02:41, jiang.peng9@zte.com.cn wrote:
> From: Peng Jiang <jiang.peng9@zte.com.cn>
>
> This patch fixes a W=1 format-string warning reported by GCC 12.3.0
> by annotating xenbus_switch_fatal() and xenbus_va_dev_error()
> with the __printf attribute. The attribute enables compile-time
> validation of printf-style format strings in these functions.
>
> The original warning trace:
> drivers/xen/xenbus/xenbus_client.c:304:9: warning: function 'xenbus_va_dev_error' might be
> a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
>
> Signed-off-by: Peng Jiang <jiang.peng9@zte.com.cn>
Reviewed-by: Juergen Gross <jgross@suse.com>
Juergen
PS: Next time please don't send another version of a patch as a reply,
but as a new email thread.
> PS: Next time please don't send another version of a patch as a reply, > but as a new email thread. Got it! New threads for future patches - thanks for the heads up.Sorry for any inconvenience caused, and thanks again for your patience with a newcomer like me. Best regards Peng
> I'm fine with the changes as such, but please send the patch as a > plain text email (no HTML). Otherwise I'm not able to apply it. > > You should look into Documentation/process/email-clients.rst in the > kernel source tree. My sincere apologies for the HTML format issue. Thank you for your patience and for pointing me to the email guidelines - I truly appreciate the guidance. I'll resend the patch immediately as a plain text email to ensure it can be properly applied. Thank you again for your understanding and for taking the time to review this. Best regards Peng
© 2016 - 2025 Red Hat, Inc.