Skip to content

Commit b7efeb0

Browse files
Jump2233jgross1
authored andcommitted
xen/xenbus: fix W=1 build warning in xenbus_va_dev_error function
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 <[email protected]> Reviewed-by: Juergen Gross <[email protected]> Message-ID: <[email protected]> Signed-off-by: Juergen Gross <[email protected]>
1 parent 347e9f5 commit b7efeb0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/xen/xenbus/xenbus_client.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ int xenbus_watch_pathfmt(struct xenbus_device *dev,
202202
}
203203
EXPORT_SYMBOL_GPL(xenbus_watch_pathfmt);
204204

205+
__printf(4, 5)
205206
static void xenbus_switch_fatal(struct xenbus_device *, int, int,
206207
const char *, ...);
207208

@@ -287,6 +288,7 @@ int xenbus_frontend_closed(struct xenbus_device *dev)
287288
}
288289
EXPORT_SYMBOL_GPL(xenbus_frontend_closed);
289290

291+
__printf(3, 0)
290292
static void xenbus_va_dev_error(struct xenbus_device *dev, int err,
291293
const char *fmt, va_list ap)
292294
{

0 commit comments

Comments
 (0)