{"id":2197888,"url":"http://patchwork.ozlabs.org/api/1.0/patches/2197888/?format=json","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.0/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260218202829.1322088-2-vsementsov@yandex-team.ru>","date":"2026-02-18T20:28:17","name":"[v3,01/12] net/af-xdp: fix type overflow","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"0c69afec63ff41602fa75f0b8187631ab1ed6866","submitter":{"id":84116,"url":"http://patchwork.ozlabs.org/api/1.0/people/84116/?format=json","name":"Vladimir Sementsov-Ogievskiy","email":"vsementsov@yandex-team.ru"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260218202829.1322088-2-vsementsov@yandex-team.ru/mbox/","series":[{"id":492602,"url":"http://patchwork.ozlabs.org/api/1.0/series/492602/?format=json","date":"2026-02-18T20:28:20","name":"net: refactoring and fixes","version":3,"mbox":"http://patchwork.ozlabs.org/series/492602/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2197888/checks/","tags":{},"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=yandex-team.ru header.i=@yandex-team.ru\n header.a=rsa-sha256 header.s=default header.b=GRkQdGs8;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)","mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net;\n dkim=pass header.i=@yandex-team.ru"],"Received":["from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fGSmq5q4sz1xwC\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 19 Feb 2026 07:30:03 +1100 (AEDT)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1vsoAV-0007HH-Jm; Wed, 18 Feb 2026 15:29:07 -0500","from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <vsementsov@yandex-team.ru>)\n id 1vsoA3-00074X-Ui\n for qemu-devel@nongnu.org; Wed, 18 Feb 2026 15:28:40 -0500","from forwardcorp1a.mail.yandex.net ([178.154.239.72])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <vsementsov@yandex-team.ru>)\n id 1vsoA0-0007rg-KK\n for qemu-devel@nongnu.org; Wed, 18 Feb 2026 15:28:38 -0500","from mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net\n (mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net\n [IPv6:2a02:6b8:c2d:3530:0:640:eca4:0])\n by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id 9D28CC038A;\n Wed, 18 Feb 2026 23:28:33 +0300 (MSK)","from vsementsov-lin (unknown [2a02:6bf:8080:53d::1:1b])\n by mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net (smtpcorp/Yandex) with\n ESMTPSA id VShB144A8iE0-fCZ88J6v; Wed, 18 Feb 2026 23:28:33 +0300"],"Precedence":"bulk","X-Yandex-Fwd":"1","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru;\n s=default; t=1771446513;\n bh=QLIq9qTK9Px46zQ/r9TYIEuLmijBWLAAX7/DLfF+Jdw=;\n h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From;\n b=GRkQdGs82gbuWUzk+LWaoqTP/Kx7DlRkW9AyS6Y+jjEO3E4JjxhQZNGD0PVNnOKes\n 7+eDEdzKQ25UOaac88AcEl0dN5wRcbAdyZ3iW/2N72dVraJUAOpkKbirTRbkcbabqF\n 3gR9qCy0TbQoPwJHHl0cxAVAc+X1zRWCpMlYbFvo=","From":"Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>","To":"jasowang@redhat.com","Cc":"qemu-devel@nongnu.org, bchaney@akamai.com, yc-core@yandex-team.ru,\n d-tatianin@yandex-team.ru, davydov-max@yandex-team.ru,\n vsementsov@yandex-team.ru, Ilya Maximets <i.maximets@ovn.org>","Subject":"[PATCH v3 01/12] net/af-xdp: fix type overflow","Date":"Wed, 18 Feb 2026 23:28:17 +0300","Message-ID":"<20260218202829.1322088-2-vsementsov@yandex-team.ru>","X-Mailer":"git-send-email 2.52.0","In-Reply-To":"<20260218202829.1322088-1-vsementsov@yandex-team.ru>","References":"<20260218202829.1322088-1-vsementsov@yandex-team.ru>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Received-SPF":"pass client-ip=178.154.239.72;\n envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net","X-Spam_score_int":"-20","X-Spam_score":"-2.1","X-Spam_bar":"--","X-Spam_report":"(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,\n SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no","X-Spam_action":"no action","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","List-Id":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"},"content":"In for-loop in net_init_af_xdp, we do nc->queue_index = i,\nwhere is is int64_t for 0 to queues-1, and nc->queue_index is\nunsigned int.\n\nAlso in parse_socket_fds, g_strv_length() returns guint which\nis equivalent to unsigned int.\n\nLet's simply use int type for queues, and update the check\nappropriately. It could be unsigned int, but in future commits\nwe'll share with net/tap.c the common function which will return\nnumber of queues or negative error. So, let's simply use int for\nqueues-related variables, that simplifies things.\n\nSigned-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>\n---\n net/af-xdp.c | 17 +++++++++--------\n 1 file changed, 9 insertions(+), 8 deletions(-)","diff":"diff --git a/net/af-xdp.c b/net/af-xdp.c\nindex 14f302ea21..ff1cb30a98 100644\n--- a/net/af-xdp.c\n+++ b/net/af-xdp.c\n@@ -442,14 +442,14 @@ static NetClientInfo net_af_xdp_info = {\n };\n \n static int *parse_socket_fds(const char *sock_fds_str,\n-                             int64_t n_expected, Error **errp)\n+                             int n_expected, Error **errp)\n {\n     gchar **substrings = g_strsplit(sock_fds_str, \":\", -1);\n-    int64_t i, n_sock_fds = g_strv_length(substrings);\n+    int i, n_sock_fds = g_strv_length(substrings);\n     int *sock_fds = NULL;\n \n     if (n_sock_fds != n_expected) {\n-        error_setg(errp, \"expected %\"PRIi64\" socket fds, got %\"PRIi64,\n+        error_setg(errp, \"expected %d socket fds, got %d\",\n                    n_expected, n_sock_fds);\n         goto exit;\n     }\n@@ -484,7 +484,7 @@ int net_init_af_xdp(const Netdev *netdev,\n     unsigned int ifindex;\n     uint32_t prog_id = 0;\n     g_autofree int *sock_fds = NULL;\n-    int64_t i, queues;\n+    int i, queues;\n     Error *err = NULL;\n     AFXDPState *s;\n     bool inhibit;\n@@ -496,13 +496,14 @@ int net_init_af_xdp(const Netdev *netdev,\n         return -1;\n     }\n \n-    queues = opts->has_queues ? opts->queues : 1;\n-    if (queues < 1) {\n+    if (opts->has_queues && (opts->queues < 1 || opts->queues > INT_MAX)) {\n         error_setg(errp, \"invalid number of queues (%\" PRIi64 \") for '%s'\",\n-                   queues, opts->ifname);\n+                   opts->queues, opts->ifname);\n         return -1;\n     }\n \n+    queues = opts->has_queues ? opts->queues : 1;\n+\n     inhibit = opts->has_inhibit && opts->inhibit;\n     if (inhibit && !opts->sock_fds && !opts->map_path) {\n         error_setg(errp, \"'inhibit=on' requires 'sock-fds' or 'map-path'\");\n@@ -537,7 +538,7 @@ int net_init_af_xdp(const Netdev *netdev,\n \n     for (i = 0; i < queues; i++) {\n         nc = qemu_new_net_client(&net_af_xdp_info, peer, \"af-xdp\", name);\n-        qemu_set_info_str(nc, \"af-xdp%\"PRIi64\" to %s\", i, opts->ifname);\n+        qemu_set_info_str(nc, \"af-xdp%d to %s\", i, opts->ifname);\n         nc->queue_index = i;\n \n         if (!nc0) {\n","prefixes":["v3","01/12"]}