mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] xen/xenbus: fix W=1 build warning in xenbus_va_dev_error  function
@ 2025-06-18  2:01 jiang.peng9
  2025-06-19 12:01 ` Jürgen Groß
  0 siblings, 1 reply; 6+ messages in thread
From: jiang.peng9 @ 2025-06-18  2:01 UTC (permalink / raw)
  To: jgross
  Cc: sstabellini, oleksandr_tyshchenko, jiang.peng9, xen-devel,
	linux-kernel, xu.xin16, yang.yang29


[-- Attachment #1.1.1: Type: text/plain, Size: 1409 bytes --]

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

[-- Attachment #1.1.2: Type: text/html , Size: 2189 bytes --]

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

end of thread, other threads:[~2025-06-21  6:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-18  2:01 [PATCH] xen/xenbus: fix W=1 build warning in xenbus_va_dev_error function jiang.peng9
2025-06-19 12:01 ` Jürgen Groß
2025-06-20  0:35   ` jiang.peng9
2025-06-20  0:41   ` [PATCH v2] " jiang.peng9
2025-06-20  9:50     ` Jürgen Groß
2025-06-21  6:11       ` jiang.peng9

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®