Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by Aibing Chen
Wed, 02 Dec 2026 04:42
[PATCH net-next] xen-netback: size the queue name for multi-digit ids
Author: Aibing Chen
Date: Wed, 02 Dec 2026 04:42
Date: Wed, 02 Dec 2026 04:42
47 lines
10255 bytes
10255 bytes
xenvif_connect() names each queue with
snprintf(queue->name, sizeof(queue->name), "%s-q%u",
be->vif->dev->name, queue->id);
QUEUE_NAME_SIZE is IFNAMSIZ + 5, which has room for a three digit queue
id. The interface name can be 15 characters and %u can print ten
digits, so the format can produce 28 bytes including the terminator into
a 21 byte buffer. gcc notices this in a W=1 build, and CONFIG_WERROR
turns it into a build failure:
drivers/net/xen-netback/xenbus.c:783:65: error: '%u' directive output
may be truncated writing between 1 and 10 bytes into a region of
size between 4 and 19 [-Werror=format-truncation=]
The id is bounded by the multi-queue-num-queues value that the guest
requests, which xen-netback validates against the max_queues module
parameter, but gcc analyses the full range of %u.
Size the buffer for what the format allows: IFNAMSIZ + 12 covers the 15
character interface name, "-q", ten digits and the terminator, and
IRQ_NAME_SIZE, which derives from it, still fits the "-tx" and "-rx"
suffixes.
No functional change for the default configuration.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/r/202606111107.k8nf2OCl-lkp@intel.com/
Signed-off-by: Aibing Chen <chenaibing@cmss.chinamobile.com>
---
drivers/net/xen-netback/common.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h
index 17421da13..b12fbb19a 100644
--- a/drivers/net/xen-netback/common.h
+++ b/drivers/net/xen-netback/common.h
@@ -98,7 +98,7 @@ struct xenvif_rx_meta {
#define XEN_NETBK_LEGACY_SLOTS_MAX XEN_NETIF_NR_SLOTS_MIN
/* Queue name is interface name with "-qNNN" appended */
-#define QUEUE_NAME_SIZE (IFNAMSIZ + 5)
+#define QUEUE_NAME_SIZE (IFNAMSIZ + 12)
/* IRQ name is queue name with "-tx" or "-rx" appended */
#define IRQ_NAME_SIZE (QUEUE_NAME_SIZE + 3)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads