From nobody Tue Feb 10 09:58:53 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1769722451; cv=none; d=zohomail.com; s=zohoarc; b=KSvHsgDWUy2QzaRlHynK7AHc83NRR3jyXfI1v0FxLaRwF1Ip5Ts3X75QoQyepiNON0Ub+8UcZ+j3UknO0swQ1s9p6/U3kBep59KEGfdvTmJZt5eKiAD6NXaAF25TcSGq8KAG6sW3jUytSY0PuU/Mly059IcSBINzcMV6GDocOXs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769722451; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=zhpdYUDyWvsRyH497N4ml/LPytT4o+SDimaUItc8UBA=; b=jGWhwKB3jiYyOx1d8QyzuEN7qWRuDXUyFFa97qkPKCG8hkINsHTWXSFWvLCcbAirz7mEZUCuFBe90wHaYEelT3fP8Gd9MIGvOPLQmkfCOtehuARSN6PF7GvK9Th5DzhePx6ppBvG6/Jh9gG+n9GDwbuqig9gihnBuz8VDdqtOwA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 176972245121035.83711755082129; Thu, 29 Jan 2026 13:34:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vlZcs-0001Wk-Cp; Thu, 29 Jan 2026 16:32:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vlZcq-0001UQ-4F for qemu-devel@nongnu.org; Thu, 29 Jan 2026 16:32:28 -0500 Received: from forwardcorp1b.mail.yandex.net ([2a02:6b8:c02:900:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vlZcm-00014l-9e for qemu-devel@nongnu.org; Thu, 29 Jan 2026 16:32:27 -0500 Received: from mail-nwsmtp-smtp-corp-canary-81.sas.yp-c.yandex.net (mail-nwsmtp-smtp-corp-canary-81.sas.yp-c.yandex.net [IPv6:2a02:6b8:c10:49f:0:640:b99a:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id 8A5338080A; Fri, 30 Jan 2026 00:32:20 +0300 (MSK) Received: from vsementsov-lin (unknown [2a02:6bf:8080:b74::1:d]) by mail-nwsmtp-smtp-corp-canary-81.sas.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id IWrbZO5AAOs0-wtJ4Q0zB; Fri, 30 Jan 2026 00:32:20 +0300 Precedence: bulk X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1769722340; bh=zhpdYUDyWvsRyH497N4ml/LPytT4o+SDimaUItc8UBA=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=syJuwqKqYu/SBmGsB2crk/ibhvn0U4r8BrUq45RXfvGYUnU9sow5D8+eK87iJdh6I PxNOvCNPQBJ2ii50wmyF1MIKjoZNWeSd/gyg+0uBrYh9Oba9yeN53k2SBPAEchVfRF IX8Dg+xF9bxm4B8q8JxWFwiZH2ULSvoOjdnTC2so= Authentication-Results: mail-nwsmtp-smtp-corp-canary-81.sas.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: jasowang@redhat.com Cc: qemu-devel@nongnu.org, bchaney@akamai.com, yc-core@yandex-team.ru, d-tatianin@yandex-team.ru, davydov-max@yandex-team.ru, vsementsov@yandex-team.ru, Ilya Maximets Subject: [PATCH v2 01/12] net/af-xdp: fix type overflow Date: Fri, 30 Jan 2026 00:32:03 +0300 Message-ID: <20260129213215.1405459-2-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260129213215.1405459-1-vsementsov@yandex-team.ru> References: <20260129213215.1405459-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a02:6b8:c02:900:1:45:d181:df01; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1b.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1769722454644158500 Content-Type: text/plain; charset="utf-8" In for-loop in net_init_af_xdp, we do nc->queue_index =3D i, where is is int64_t for 0 to queues-1, and nc->queue_index is unsigned int. Also in parse_socket_fds, g_strv_length() returns guint which is equivalent to unsigned int. Let's simply use unsigned int type for queues, and update the check appropriately. Signed-off-by: Vladimir Sementsov-Ogievskiy --- net/af-xdp.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/net/af-xdp.c b/net/af-xdp.c index 14f302ea21..bb7a7d8e33 100644 --- a/net/af-xdp.c +++ b/net/af-xdp.c @@ -442,14 +442,14 @@ static NetClientInfo net_af_xdp_info =3D { }; =20 static int *parse_socket_fds(const char *sock_fds_str, - int64_t n_expected, Error **errp) + unsigned n_expected, Error **errp) { gchar **substrings =3D g_strsplit(sock_fds_str, ":", -1); - int64_t i, n_sock_fds =3D g_strv_length(substrings); + unsigned i, n_sock_fds =3D g_strv_length(substrings); int *sock_fds =3D NULL; =20 if (n_sock_fds !=3D n_expected) { - error_setg(errp, "expected %"PRIi64" socket fds, got %"PRIi64, + error_setg(errp, "expected %u socket fds, got %u", n_expected, n_sock_fds); goto exit; } @@ -484,7 +484,7 @@ int net_init_af_xdp(const Netdev *netdev, unsigned int ifindex; uint32_t prog_id =3D 0; g_autofree int *sock_fds =3D NULL; - int64_t i, queues; + unsigned i, queues; Error *err =3D NULL; AFXDPState *s; bool inhibit; @@ -496,13 +496,14 @@ int net_init_af_xdp(const Netdev *netdev, return -1; } =20 - queues =3D opts->has_queues ? opts->queues : 1; - if (queues < 1) { + if (opts->has_queues && (opts->queues < 0 || opts->queues > UINT_MAX))= { error_setg(errp, "invalid number of queues (%" PRIi64 ") for '%s'", - queues, opts->ifname); + opts->queues, opts->ifname); return -1; } =20 + queues =3D opts->has_queues ? opts->queues : 1; + inhibit =3D opts->has_inhibit && opts->inhibit; if (inhibit && !opts->sock_fds && !opts->map_path) { error_setg(errp, "'inhibit=3Don' requires 'sock-fds' or 'map-path'= "); @@ -537,7 +538,7 @@ int net_init_af_xdp(const Netdev *netdev, =20 for (i =3D 0; i < queues; i++) { nc =3D qemu_new_net_client(&net_af_xdp_info, peer, "af-xdp", name); - qemu_set_info_str(nc, "af-xdp%"PRIi64" to %s", i, opts->ifname); + qemu_set_info_str(nc, "af-xdp%u to %s", i, opts->ifname); nc->queue_index =3D i; =20 if (!nc0) { --=20 2.52.0