lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250618100153468I5faNUAhCdtMA01OuuTKC@zte.com.cn>
Date: Wed, 18 Jun 2025 10:01:53 +0800 (CST)
From: <jiang.peng9@....com.cn>
To: <jgross@...e.com>
Cc: <sstabellini@...nel.org>, <oleksandr_tyshchenko@...m.com>,
        <jiang.peng9@....com.cn>, <xen-devel@...ts.xenproject.org>,
        <linux-kernel@...r.kernel.org>, <xu.xin16@....com.cn>,
        <yang.yang29@....com.cn>
Subject: [PATCH] xen/xenbus: fix W=1 build warning in xenbus_va_dev_error
 function

From: Peng Jiang <jiang.peng9@....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@....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
<div class="zcontentRow"><p>From: Peng Jiang &lt;jiang.peng9@....com.cn&gt;</p><p><br></p><p>This patch fixes a W=1 format-string warning reported by GCC 12.3.0</p><p>by annotating xenbus_switch_fatal() and xenbus_va_dev_error()</p><p>with the __printf attribute. The attribute enables compile-time</p><p>validation of printf-style format strings in these functions.</p><p><br></p><p>The original warning trace:</p><p>drivers/xen/xenbus/xenbus_client.c:304:9: warning: function 'xenbus_va_dev_error' might be</p><p>a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]</p><p><br></p><p>Signed-off-by: Peng Jiang &lt;jiang.peng9@....com.cn&gt;</p><p>---</p><p>&nbsp;drivers/xen/xenbus/xenbus_client.c | 2 ++</p><p>&nbsp;1 file changed, 2 insertions(+)</p><p><br></p><p>diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c</p><p>index 51b3124b0d56..e73ec225d4a6 100644</p><p>--- a/drivers/xen/xenbus/xenbus_client.c</p><p>+++ b/drivers/xen/xenbus/xenbus_client.c</p><p>@@ -202,6 +202,7 @@ int xenbus_watch_pathfmt(struct xenbus_device *dev,</p><p>&nbsp;}</p><p>&nbsp;EXPORT_SYMBOL_GPL(xenbus_watch_pathfmt);</p><p>&nbsp;</p><p>+__printf(4, 5)</p><p>&nbsp;static void xenbus_switch_fatal(struct xenbus_device *, int, int,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; const char *, ...);</p><p>&nbsp;</p><p>@@ -287,6 +288,7 @@ int xenbus_frontend_closed(struct xenbus_device *dev)</p><p>&nbsp;}</p><p>&nbsp;EXPORT_SYMBOL_GPL(xenbus_frontend_closed);</p><p>&nbsp;</p><p>+__printf(3, 0)</p><p>&nbsp;static void xenbus_va_dev_error(struct xenbus_device *dev, int err,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; const char *fmt, va_list ap)</p><p>&nbsp;{</p><p>--&nbsp;</p><p>2.25.1</p><p style="font-size:14px;font-family:微软雅黑,Microsoft YaHei;"><br></p><p style="font-size:14px;font-family:微软雅黑,Microsoft YaHei;"><br></p><p style="font-size:14px;font-family:微软雅黑,Microsoft YaHei;"><br></p><p style="font-size:14px;font-family:微软雅黑,Microsoft YaHei;"><br></p></div>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ