From nobody Sat Nov 15 08:50:43 2025 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1753077678; cv=none; d=zohomail.com; s=zohoarc; b=IPbDQT1BO3CpmSlnqGJy3BTI/Y4l4EcZ6nTcydxyxIlnMK20WRUKoMt+xdw8aKqy5hJkcb/U10hpQMNFv1bpgNDxauN6LzH9S0EokresDaybe8XL/RrjX9D9SAD5bNlXLcU2Ae6EBIX92SynaDLH/qsrHvau3Ugp7bTIJ7G4gzE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753077678; h=Content-Type: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=1aXwN4h+5NWvUK9uc0dLGqkRb9fIsj01GkAtL71dIXQ=; b=W0LPWG7p47tkXazjt3MBnLa1J9DrUxEQ+xnFUZTVKCj9gPsark2r0laJiLL3Mcp6JOloGJMsQX6K14ml1bW9PxZ07fXnVGFR/t1lGY4G5fqYfnmRQ1D7h0koWc9IpEE/AHGtUnxpW+VZ5iozDraMeSZktY+PGRe/hF0Fa0nq0Og= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1753077678234302.3977486608219; Sun, 20 Jul 2025 23:01:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1udjZG-0008Gh-15; Mon, 21 Jul 2025 02:00:28 -0400 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 1udjYt-0008Ai-Td for qemu-devel@nongnu.org; Mon, 21 Jul 2025 01:59:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1udjYr-000664-Sf for qemu-devel@nongnu.org; Mon, 21 Jul 2025 01:59:43 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-643-UiE96Yw1OeCJfFM-hUfW3g-1; Mon, 21 Jul 2025 01:59:38 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D9BF41800C34; Mon, 21 Jul 2025 05:59:37 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.112.190]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1068B19560AD; Mon, 21 Jul 2025 05:59:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1753077580; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1aXwN4h+5NWvUK9uc0dLGqkRb9fIsj01GkAtL71dIXQ=; b=FFDWM4mXuf8CtweB/D7ccP9Wmmq7oXle88J3hxapBstJ/Ml5O8LWb43RZlKtvtvBC3UT02 RA4sIdc6TvVQvOA7lTw6zZFgMEf2z3UBSWJHDEfc8ztRiIf8ZBbTXSFpzoi8Zu7NJJCuT+ KWPQFTAJkaxKmjhPBtxRzFadpFR8br4= X-MC-Unique: UiE96Yw1OeCJfFM-hUfW3g-1 X-Mimecast-MFC-AGG-ID: UiE96Yw1OeCJfFM-hUfW3g_1753077578 From: Jason Wang To: qemu-devel@nongnu.org Cc: Vladimir Sementsov-Ogievskiy , Lei Yang , Jason Wang Subject: [PULL 01/12] net/tap: drop too small packets Date: Mon, 21 Jul 2025 13:59:16 +0800 Message-ID: <20250721055927.75951-2-jasowang@redhat.com> In-Reply-To: <20250721055927.75951-1-jasowang@redhat.com> References: <20250721055927.75951-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=170.10.129.124; envelope-from=jasowang@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.088, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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 Precedence: list List-Id: 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 @redhat.com) X-ZM-MESSAGEID: 1753077680888116600 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Theoretically tap_read_packet() may return size less than s->host_vnet_hdr_len, and next, we'll work with negative size (in case of !s->using_vnet_hdr). Let's avoid it. Don't proceed with size =3D=3D s->host_vnet_hdr_len as well in case of !s->using_vnet_hdr, it doesn't make sense. Tested-by: Lei Yang Signed-off-by: Vladimir Sementsov-Ogievskiy Signed-off-by: Jason Wang --- net/tap.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/tap.c b/net/tap.c index 23536c09b4..2a85936019 100644 --- a/net/tap.c +++ b/net/tap.c @@ -190,6 +190,11 @@ static void tap_send(void *opaque) break; } =20 + if (s->host_vnet_hdr_len && size <=3D s->host_vnet_hdr_len) { + /* Invalid packet */ + break; + } + if (s->host_vnet_hdr_len && !s->using_vnet_hdr) { buf +=3D s->host_vnet_hdr_len; size -=3D s->host_vnet_hdr_len; --=20 2.42.0 From nobody Sat Nov 15 08:50:43 2025 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1753077710; cv=none; d=zohomail.com; s=zohoarc; b=kQctR3ddgcKCXGueg7Cqp/Eox17TC9lorGxNUp7S/hIcQYRwPtk+ZLACoXB0kP86tyQB6/RC2FjV7PVU/wbixBct1kCaWHaWN5QC7Trlon7yuLvhqWpePjIKjnKQc7ucGsZ5JvaHydsW6BV5mgya+nl6Gh295pB0oGe318WzpEY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753077710; h=Content-Type: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=0JscNhwd78VHvraiWW7XVgG/TrI6DefncU95YkqltVc=; b=bvzv9c30lRbBrVa8sQTw5AkAJJvYCVbRqJPaAZgT++f8gt/6K+NbSxwC1jm+lQ9lOMlWLFgdzz7IA9PPP7JNkhCMZsEKErF2Om0YHnX+/SJLRfBv8R4wURpsCagSAxseU56nAYpcdNiWKOela0nXOG0so7o1Sz/AZZtcTk16P/8= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1753077709973155.81841983685683; Sun, 20 Jul 2025 23:01:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1udjaJ-0000FW-BB; Mon, 21 Jul 2025 02:01:20 -0400 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 1udjYy-0008Ar-5D for qemu-devel@nongnu.org; Mon, 21 Jul 2025 01:59:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1udjYw-00066p-CQ for qemu-devel@nongnu.org; Mon, 21 Jul 2025 01:59:47 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-240-2FAKuCOGMC-OjN9ca4i4Yw-1; Mon, 21 Jul 2025 01:59:41 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9D7B41800366; Mon, 21 Jul 2025 05:59:40 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.112.190]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 80C60195608D; Mon, 21 Jul 2025 05:59:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1753077585; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0JscNhwd78VHvraiWW7XVgG/TrI6DefncU95YkqltVc=; b=A+LUO0vbBfvixofotxzTwvjNFVBoOeXfHLRtRmbzo+xjiAOhjYQ3xC/TqOlX+zsS7en9s1 k6IwVWfA4V2X0nLu5Y0HBKAZuGkzF/QIVSosGMPgaFpuT7HRTUFM5PQ7igcSiYKXlvxFrO RazRkoTQCGjoPQJ5ehnCaaONbXTQhxA= X-MC-Unique: 2FAKuCOGMC-OjN9ca4i4Yw-1 X-Mimecast-MFC-AGG-ID: 2FAKuCOGMC-OjN9ca4i4Yw_1753077580 From: Jason Wang To: qemu-devel@nongnu.org Cc: Steve Sistare , Jason Wang Subject: [PULL 02/12] tap: fix net_init_tap() return code Date: Mon, 21 Jul 2025 13:59:17 +0800 Message-ID: <20250721055927.75951-3-jasowang@redhat.com> In-Reply-To: <20250721055927.75951-1-jasowang@redhat.com> References: <20250721055927.75951-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=170.10.133.124; envelope-from=jasowang@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.088, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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 Precedence: list List-Id: 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 @redhat.com) X-ZM-MESSAGEID: 1753077711237116600 Content-Type: text/plain; charset="utf-8" From: Steve Sistare net_init_tap intends to return 0 for success and -1 on error. However, when net_init_tap() succeeds for a multi-queue device, it returns 1, because of this code where ret becomes 1 when g_unix_set_fd_nonblocking succeeds: ret =3D g_unix_set_fd_nonblocking(fd, true, NULL); if (!ret) { ... error ... free_fail: ... return ret; Luckily, the only current call site checks for negative, rather than non-ze= ro: net_client_init1() if (net_client_init_fun[](...) < 0) Also, in the unlikely case that g_unix_set_fd_nonblocking fails and returns false, ret=3D0 is returned, and net_client_init1 will use a broken interfac= e. Fix it to be future proof. Signed-off-by: Steve Sistare Signed-off-by: Jason Wang --- net/tap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/tap.c b/net/tap.c index 2a85936019..f7df702f97 100644 --- a/net/tap.c +++ b/net/tap.c @@ -895,8 +895,8 @@ int net_init_tap(const Netdev *netdev, const char *name, goto free_fail; } =20 - ret =3D g_unix_set_fd_nonblocking(fd, true, NULL); - if (!ret) { + if (!g_unix_set_fd_nonblocking(fd, true, NULL)) { + ret =3D -1; error_setg_errno(errp, errno, "%s: Can't use file descript= or %d", name, fd); goto free_fail; --=20 2.42.0 From nobody Sat Nov 15 08:50:43 2025 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1753077714; cv=none; d=zohomail.com; s=zohoarc; b=bROGdgcPIuTgDkViNFy0pUPdA0I2sc/F8bSZEPXvMVyYGyO5jdqguqiGNchKzIzMqNX6QH2ewzND3afKwhysmEsNGGOPLd1Ugt1XJJRgESfJ5aAFqnmnAy5c0BW+ul0FovVtYyO8y2H/TGWegHkkL25zdD/q5oChn9mjKoy+1Nw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753077714; h=Content-Type: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=B+YOWVyBM2NC9L7cVU6GfA7Ln+4xlkaVPQo1sEz1p2Y=; b=YAQs0qsvDMvmS6UaHQKlTlEHJkq2FcZxUlHqlxIcYdMWBDXIS/uRAhxCHcKviwEQzjhFHlqQb0B8TxDWRESyR3oEP9DDjs0YuQBoPB4/ZVOyZC0Ac4vK4T7vuBay8TKVTGP3NqMYlwmK7WSoTm90LHk6W/X53AxlF0/237kjPoI= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1753077714930142.47965161414106; Sun, 20 Jul 2025 23:01:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1udjaJ-0000FS-B0; Mon, 21 Jul 2025 02:01:20 -0400 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 1udjZ1-0008Bv-0N for qemu-devel@nongnu.org; Mon, 21 Jul 2025 01:59:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1udjYx-000678-SX for qemu-devel@nongnu.org; Mon, 21 Jul 2025 01:59:49 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-299-wBQNHcxhNaCP1DEBSYW79Q-1; Mon, 21 Jul 2025 01:59:44 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C45691800286; Mon, 21 Jul 2025 05:59:43 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.112.190]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5D130195608D; Mon, 21 Jul 2025 05:59:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1753077587; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=B+YOWVyBM2NC9L7cVU6GfA7Ln+4xlkaVPQo1sEz1p2Y=; b=HY8a6WRZUXM2pKtFgSwHYdcMLz6o4N7rXgkTXk56By7+tfZpHHrL5O4DB0c4jTC9FHPGQK /vPvMj3t1/8gxe7yLnGp0A004ZofVI/LElBA0AMR5+7PoJG8Kn9b0ID+KfR7Y2km0l0LK+ SPOY97mphe1U5oBM/kJ/FM+128FLcWg= X-MC-Unique: wBQNHcxhNaCP1DEBSYW79Q-1 X-Mimecast-MFC-AGG-ID: wBQNHcxhNaCP1DEBSYW79Q_1753077583 From: Jason Wang To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-stable@nongnu.org, Jason Wang Subject: [PULL 03/12] hw/net/npcm_gmac.c: Send the right data for second packet in a row Date: Mon, 21 Jul 2025 13:59:18 +0800 Message-ID: <20250721055927.75951-4-jasowang@redhat.com> In-Reply-To: <20250721055927.75951-1-jasowang@redhat.com> References: <20250721055927.75951-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=170.10.129.124; envelope-from=jasowang@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.088, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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 Precedence: list List-Id: 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 @redhat.com) X-ZM-MESSAGEID: 1753077717341116600 Content-Type: text/plain; charset="utf-8" From: Peter Maydell The transmit loop in gmac_try_send_next_packet() is constructed in a way that means it will send incorrect data if it it sends more than one packet. The function assembles the outbound data in a dynamically allocated block of memory which is pointed to by tx_send_buffer. We track the first point in this block of memory which is not yet used with the prev_buf_size offset, initially zero. We track the size of the packet we're sending with the length variable, also initially zero. As we read chunks of data out of guest memory, we write them to tx_send_buffer[prev_buf_size], and then increment both prev_buf_size and length. (We might dynamically reallocate the buffer if needed.) When we send a packet, we checksum and send length bytes, starting at tx_send_buffer, and then we reset length to 0. This gives the right data for the first packet. But we don't reset prev_buf_size. This means that if we process more descriptors with further data for the next packet, that data will continue to accumulate at offset prev_buf_size, i.e. after the data for the first packet. But when we transmit that second packet, we send length bytes from tx_send_buffer, so we will send a packet which has the length of the second packet but the data of the first one. The fix for this is to also clear prev_buf_size after the packet has been sent -- we never need the data from packet one after we've sent it, so we can write packet two's data starting at the beginning of the buffer. Cc: qemu-stable@nongnu.org Signed-off-by: Peter Maydell Signed-off-by: Jason Wang --- hw/net/npcm_gmac.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/net/npcm_gmac.c b/hw/net/npcm_gmac.c index a434112580..921327dd8c 100644 --- a/hw/net/npcm_gmac.c +++ b/hw/net/npcm_gmac.c @@ -615,6 +615,7 @@ static void gmac_try_send_next_packet(NPCMGMACState *gm= ac) trace_npcm_gmac_packet_sent(DEVICE(gmac)->canonical_path, leng= th); buf =3D tx_send_buffer; length =3D 0; + prev_buf_size =3D 0; } =20 /* step 6 */ --=20 2.42.0 From nobody Sat Nov 15 08:50:43 2025 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1753077842; cv=none; d=zohomail.com; s=zohoarc; b=mqukVLJN5XblyWKB/qpY4mOlBCu1aXKd/smJ3eOMIEjc9WWLGMQV0KywK7vuNRSWkkddkae97m4VaUAIthvjaWw5aM8uCw8PSQNPZ8v9dv7YElU7lE3lfUIPOYlMb8Ealxs5Xo51xnaCgJmCziA8tpOwKOrjcGYbEIQcUV8Jx4U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753077842; h=Content-Type: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=so4o0qh5eAFTTG1tWk2RBAHz3wYv4RnAAL56VvPJxoo=; b=EA0dmYeGJhRxHNfDfqM/Osqv7xGjJHMakfTNco+m1Cxq6KqCUpv3Tjzwh+WnX+9sHkYbGE+2+yGdH/lOZwwGn1V3cbsR0YltmrodEuXagdTVoJMFhkWH5WMYa4eAVeWZ6z9fg+t25PGmGaNX4b9X5EGLztNlwp7YVlFZtOJe37E= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1753077842245891.6428629162733; Sun, 20 Jul 2025 23:04:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1udjbE-000100-2f; Mon, 21 Jul 2025 02:02:08 -0400 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 1udjZ3-0008CV-J1 for qemu-devel@nongnu.org; Mon, 21 Jul 2025 01:59:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1udjZ0-00067R-PK for qemu-devel@nongnu.org; Mon, 21 Jul 2025 01:59:53 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-617-PnX5GBeuOcWCuSts5n10_A-1; Mon, 21 Jul 2025 01:59:47 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 747CD195FE11; Mon, 21 Jul 2025 05:59:46 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.112.190]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 838BB195608D; Mon, 21 Jul 2025 05:59:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1753077589; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=so4o0qh5eAFTTG1tWk2RBAHz3wYv4RnAAL56VvPJxoo=; b=eczSgr5tnQcM3apjbeJhPJVrgFvh/l668MtYHZr211z+SuzWAjASX6ILQu3kKqq8buARzG 9Q0NVBXZyniahAKB6uaUnIoGg4O2vIFZK3Q2m1zqINi9gWpOMrXReWhig0UrrFEAa3kvzu zTkDBBOFwpvTLylk1UUUMN+eN4YuEZI= X-MC-Unique: PnX5GBeuOcWCuSts5n10_A-1 X-Mimecast-MFC-AGG-ID: PnX5GBeuOcWCuSts5n10_A_1753077586 From: Jason Wang To: qemu-devel@nongnu.org Cc: Peter Maydell , Jason Wang Subject: [PULL 04/12] hw/net/npcm_gmac.c: Unify length and prev_buf_size variables Date: Mon, 21 Jul 2025 13:59:19 +0800 Message-ID: <20250721055927.75951-5-jasowang@redhat.com> In-Reply-To: <20250721055927.75951-1-jasowang@redhat.com> References: <20250721055927.75951-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=170.10.129.124; envelope-from=jasowang@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.088, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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 Precedence: list List-Id: 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 @redhat.com) X-ZM-MESSAGEID: 1753077844355116600 Content-Type: text/plain; charset="utf-8" From: Peter Maydell After the bug fix in the previous commit, the length and prev_buf_size variables are identical, except that prev_buf_size is uint32_t and length is uint16_t. We can therefore unify them. The only place where the type makes a difference is that we will truncate the packet at 64K when sending it; this commit preserves that behaviour by using a local variable when doing the packet send. Signed-off-by: Peter Maydell Signed-off-by: Jason Wang --- hw/net/npcm_gmac.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/net/npcm_gmac.c b/hw/net/npcm_gmac.c index 921327dd8c..a0050a7725 100644 --- a/hw/net/npcm_gmac.c +++ b/hw/net/npcm_gmac.c @@ -516,7 +516,6 @@ static void gmac_try_send_next_packet(NPCMGMACState *gm= ac) uint32_t desc_addr; struct NPCMGMACTxDesc tx_desc; uint32_t tx_buf_addr, tx_buf_len; - uint16_t length =3D 0; uint8_t *buf =3D tx_send_buffer; uint32_t prev_buf_size =3D 0; int csum =3D 0; @@ -583,7 +582,6 @@ static void gmac_try_send_next_packet(NPCMGMACState *gm= ac) __func__, tx_buf_addr); return; } - length +=3D tx_buf_len; prev_buf_size +=3D tx_buf_len; =20 /* If not chained we'll have a second buffer. */ @@ -606,15 +604,18 @@ static void gmac_try_send_next_packet(NPCMGMACState *= gmac) __func__, tx_buf_addr); return; } - length +=3D tx_buf_len; prev_buf_size +=3D tx_buf_len; } if (tx_desc.tdes1 & TX_DESC_TDES1_LAST_SEG_MASK) { + /* + * This will truncate the packet at 64K. + * TODO: find out if this is the correct behaviour. + */ + uint16_t length =3D prev_buf_size; net_checksum_calculate(tx_send_buffer, length, csum); qemu_send_packet(qemu_get_queue(gmac->nic), tx_send_buffer, le= ngth); trace_npcm_gmac_packet_sent(DEVICE(gmac)->canonical_path, leng= th); buf =3D tx_send_buffer; - length =3D 0; prev_buf_size =3D 0; } =20 --=20 2.42.0 From nobody Sat Nov 15 08:50:43 2025 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1753077678; cv=none; d=zohomail.com; s=zohoarc; b=VUa2xGUazDl2QsMfUK7v6Se2M1H8ydsiKIiqeDfpjuQDWxg8Lxg0YSG8ScMxbbxQ/29X9ZDHBnUpk0EbedWvJL+wLVaTFt2/+k0jk9HxIp63T+KNrpHY9mVzdKmHDOZhnRv/nrbACkL0zMFr23mzUB5u0pqitC9ytsS53MeHggA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753077678; h=Content-Type: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=5KWT+/o3dTqGxj2GxT8gQwaUixPakGt6yMy2ciNkG3w=; b=JI24Db8/bIxAUSWTpwz3gz+NtMrN1AfdbZAZLTC5jzLzhsAiU8HJfQGHE7FK5uLUqlVyCPFnKR9ySit56eIvXLuhFZT9rP5tlk2y4ETMzUKd1VXIzUaaFBCivyvsiyhNeQwgAwbpkrbu6MUP26liXz3cigORD+e3zeACHNQMXfI= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1753077678139821.324144171799; Sun, 20 Jul 2025 23:01:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1udjZj-0008L6-Ou; Mon, 21 Jul 2025 02:00:41 -0400 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 1udjZ4-0008Cl-G9 for qemu-devel@nongnu.org; Mon, 21 Jul 2025 01:59:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1udjZ2-00067s-Rv for qemu-devel@nongnu.org; Mon, 21 Jul 2025 01:59:54 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-677-JWcRK7uvNIm9-G3zb9D82A-1; Mon, 21 Jul 2025 01:59:50 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1D9931800C30; Mon, 21 Jul 2025 05:59:49 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.112.190]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 33E59195608D; Mon, 21 Jul 2025 05:59:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1753077592; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5KWT+/o3dTqGxj2GxT8gQwaUixPakGt6yMy2ciNkG3w=; b=hvHFMNZZWq1TVipq4SUE3YDx4GaERhrPVFq9RUQSnsGrat1RgHlaS9xB+BgrQzGdO3CkeL G0cTvYpz6XrGA5a5RkymkvddjSoCSPhC9C4YYUSlQ4/cVePpmxLBZuqs9tsZeHPIUupdG8 rEtKUQd9rLdNUrHGjC7q9+Ii7aXbvOc= X-MC-Unique: JWcRK7uvNIm9-G3zb9D82A-1 X-Mimecast-MFC-AGG-ID: JWcRK7uvNIm9-G3zb9D82A_1753077589 From: Jason Wang To: qemu-devel@nongnu.org Cc: Peter Maydell , Jason Wang Subject: [PULL 05/12] hw/net/npcm_gmac.c: Correct test for when to reallocate packet buffer Date: Mon, 21 Jul 2025 13:59:20 +0800 Message-ID: <20250721055927.75951-6-jasowang@redhat.com> In-Reply-To: <20250721055927.75951-1-jasowang@redhat.com> References: <20250721055927.75951-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=170.10.129.124; envelope-from=jasowang@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.088, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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 Precedence: list List-Id: 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 @redhat.com) X-ZM-MESSAGEID: 1753077680960116600 Content-Type: text/plain; charset="utf-8" From: Peter Maydell In gmac_try_send_next_packet() we have code that does "if this block of data won't fit in the buffer, reallocate it". However, the condition it uses is if ((prev_buf_size + tx_buf_len) > sizeof(buf)) where buf is a uint8_t *. This means that sizeof(buf) is always 8 bytes, and the condition will almost always be true, so we will reallocate the buffer more often than we need to. Correct the condition to test against tx_buffer_size, which is where we track how big the allocated buffer is. Signed-off-by: Peter Maydell Signed-off-by: Jason Wang --- hw/net/npcm_gmac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/net/npcm_gmac.c b/hw/net/npcm_gmac.c index a0050a7725..0c17ae9b2a 100644 --- a/hw/net/npcm_gmac.c +++ b/hw/net/npcm_gmac.c @@ -569,7 +569,7 @@ static void gmac_try_send_next_packet(NPCMGMACState *gm= ac) tx_buf_len =3D TX_DESC_TDES1_BFFR1_SZ_MASK(tx_desc.tdes1); buf =3D &tx_send_buffer[prev_buf_size]; =20 - if ((prev_buf_size + tx_buf_len) > sizeof(buf)) { + if ((prev_buf_size + tx_buf_len) > tx_buffer_size) { tx_buffer_size =3D prev_buf_size + tx_buf_len; tx_send_buffer =3D g_realloc(tx_send_buffer, tx_buffer_size); buf =3D &tx_send_buffer[prev_buf_size]; @@ -591,7 +591,7 @@ static void gmac_try_send_next_packet(NPCMGMACState *gm= ac) tx_buf_len =3D TX_DESC_TDES1_BFFR2_SZ_MASK(tx_desc.tdes1); buf =3D &tx_send_buffer[prev_buf_size]; =20 - if ((prev_buf_size + tx_buf_len) > sizeof(buf)) { + if ((prev_buf_size + tx_buf_len) > tx_buffer_size) { tx_buffer_size =3D prev_buf_size + tx_buf_len; tx_send_buffer =3D g_realloc(tx_send_buffer, tx_buffer_siz= e); buf =3D &tx_send_buffer[prev_buf_size]; --=20 2.42.0 From nobody Sat Nov 15 08:50:43 2025 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1753077980; cv=none; d=zohomail.com; s=zohoarc; b=CN2Pv98rzQfyqUHMoDdCDRBRWopt3xVX/P1wpi44MtedGr1IL5fw96pTZaUW0aReKGzl/vE0S8p6rxLqF1z/6Ec44NNXQopGZqiS695AiLmUEqbbUFkvJVyoklyqcaTZSyXddI2tPTN5kSU2o9OE5Vl8zN0D5cAQAiZcBiggbHs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753077980; h=Content-Type: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=xnYOJbXEeP/53KinnYaU63GnFaShL0QvpZTkjzNCw64=; b=IRlRedKirMXgYkNsccDPRxEZ5TDD3PMJWIgfdogFUCDwMan7MSgbRhPUZ0QGRne4mGd10g5xLVfN8vPOzEsC6smqBcpHq+gmmdXDEufue0q5Sl1QceQtcGD2xG/8L8OuOMdNc10Yj+2je9fZ4Ap58EWrvQhdmofVmjSxZu+NO00= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 175307798051956.577819997294114; Sun, 20 Jul 2025 23:06:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1udjd3-0002c6-22; Mon, 21 Jul 2025 02:04:02 -0400 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 1udjZA-0008ID-Ar for qemu-devel@nongnu.org; Mon, 21 Jul 2025 02:00:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1udjZ6-000696-Sx for qemu-devel@nongnu.org; Mon, 21 Jul 2025 01:59:59 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-630-jHw9vkwsN4ynLu9qh0-WNw-1; Mon, 21 Jul 2025 01:59:52 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CE2C6195FD06; Mon, 21 Jul 2025 05:59:51 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.112.190]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D1642195608D; Mon, 21 Jul 2025 05:59:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1753077596; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xnYOJbXEeP/53KinnYaU63GnFaShL0QvpZTkjzNCw64=; b=MbCCcAhBrGOZdcupWpWL3+sw+yX0O3h8o+wiqUVPI3IrTIBLAWBrM2nqjKezPHbx5Fr4Ay kpp3djWsP5LPYSQtp/YZjAWSqlYflmyN4Y4PWFl6IL0Z+wQYCgyAAsFXw6f1Tqxi6XSEOZ Mp31kGArmrDkExGgKsB0YtT1ueFVqBk= X-MC-Unique: jHw9vkwsN4ynLu9qh0-WNw-1 X-Mimecast-MFC-AGG-ID: jHw9vkwsN4ynLu9qh0-WNw_1753077591 From: Jason Wang To: qemu-devel@nongnu.org Cc: Peter Maydell , Jason Wang Subject: [PULL 06/12] hw/net/npcm_gmac.c: Drop 'buf' local variable Date: Mon, 21 Jul 2025 13:59:21 +0800 Message-ID: <20250721055927.75951-7-jasowang@redhat.com> In-Reply-To: <20250721055927.75951-1-jasowang@redhat.com> References: <20250721055927.75951-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=170.10.133.124; envelope-from=jasowang@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.088, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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 Precedence: list List-Id: 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 @redhat.com) X-ZM-MESSAGEID: 1753077982015116600 Content-Type: text/plain; charset="utf-8" From: Peter Maydell We use the local variable 'buf' only when we call dma_memory_read(), and it is always set to &tx_send_buffer[prev_buf_size] immediately before both of those calls. So remove the variable and pass tx_send_buffer + prev_buf_size to dma_memory_read(). This fixes in passing a place where we set buf =3D tx_send_buffer but never used that value because we always updated buf to something else later before using it. Coverity: CID 1534027 Signed-off-by: Peter Maydell Signed-off-by: Jason Wang --- hw/net/npcm_gmac.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/hw/net/npcm_gmac.c b/hw/net/npcm_gmac.c index 0c17ae9b2a..5e32cd3edf 100644 --- a/hw/net/npcm_gmac.c +++ b/hw/net/npcm_gmac.c @@ -516,7 +516,6 @@ static void gmac_try_send_next_packet(NPCMGMACState *gm= ac) uint32_t desc_addr; struct NPCMGMACTxDesc tx_desc; uint32_t tx_buf_addr, tx_buf_len; - uint8_t *buf =3D tx_send_buffer; uint32_t prev_buf_size =3D 0; int csum =3D 0; =20 @@ -567,16 +566,15 @@ static void gmac_try_send_next_packet(NPCMGMACState *= gmac) tx_buf_addr =3D tx_desc.tdes2; gmac->regs[R_NPCM_DMA_CUR_TX_BUF_ADDR] =3D tx_buf_addr; tx_buf_len =3D TX_DESC_TDES1_BFFR1_SZ_MASK(tx_desc.tdes1); - buf =3D &tx_send_buffer[prev_buf_size]; =20 if ((prev_buf_size + tx_buf_len) > tx_buffer_size) { tx_buffer_size =3D prev_buf_size + tx_buf_len; tx_send_buffer =3D g_realloc(tx_send_buffer, tx_buffer_size); - buf =3D &tx_send_buffer[prev_buf_size]; } =20 /* step 5 */ - if (dma_memory_read(&address_space_memory, tx_buf_addr, buf, + if (dma_memory_read(&address_space_memory, tx_buf_addr, + tx_send_buffer + prev_buf_size, tx_buf_len, MEMTXATTRS_UNSPECIFIED)) { qemu_log_mask(LOG_GUEST_ERROR, "%s: Failed to read packet @ 0x= %x\n", __func__, tx_buf_addr); @@ -589,15 +587,14 @@ static void gmac_try_send_next_packet(NPCMGMACState *= gmac) tx_buf_addr =3D tx_desc.tdes3; gmac->regs[R_NPCM_DMA_CUR_TX_BUF_ADDR] =3D tx_buf_addr; tx_buf_len =3D TX_DESC_TDES1_BFFR2_SZ_MASK(tx_desc.tdes1); - buf =3D &tx_send_buffer[prev_buf_size]; =20 if ((prev_buf_size + tx_buf_len) > tx_buffer_size) { tx_buffer_size =3D prev_buf_size + tx_buf_len; tx_send_buffer =3D g_realloc(tx_send_buffer, tx_buffer_siz= e); - buf =3D &tx_send_buffer[prev_buf_size]; } =20 - if (dma_memory_read(&address_space_memory, tx_buf_addr, buf, + if (dma_memory_read(&address_space_memory, tx_buf_addr, + tx_send_buffer + prev_buf_size, tx_buf_len, MEMTXATTRS_UNSPECIFIED)) { qemu_log_mask(LOG_GUEST_ERROR, "%s: Failed to read packet @ 0x%x\n", @@ -615,7 +612,6 @@ static void gmac_try_send_next_packet(NPCMGMACState *gm= ac) net_checksum_calculate(tx_send_buffer, length, csum); qemu_send_packet(qemu_get_queue(gmac->nic), tx_send_buffer, le= ngth); trace_npcm_gmac_packet_sent(DEVICE(gmac)->canonical_path, leng= th); - buf =3D tx_send_buffer; prev_buf_size =3D 0; } =20 --=20 2.42.0 From nobody Sat Nov 15 08:50:43 2025 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1753077835; cv=none; d=zohomail.com; s=zohoarc; b=TGQyjs1/0chXRG0oSESTpCRCUrsb9h0wcMuL4I8/7UnuKvyimSnMLWFG30WsTOVXM53sItYEa+LFbiGBjhPR/dvTqv6Hq7E4aN1xDsZdHGO69LcElSdYjIC6+AC1S8icUo1CaUg9OQ2q9BgdS4Uq2C8Rdj6g1YnAB5VPQ3ZnOYU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753077835; h=Content-Type: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=r27fFDv0rcrOqMogFBb3ERRL57PzfIvzx8FWyvucAqo=; b=lgEOVkDsucifcRQjMpNlSLkf67VGh0PCN8AmzeQOaXdzpJTKqIPlJ1ijRLT57PbctDpHVe20k2a2cyW0zlp2hxnf17XA5MnW29G69YyKKEvoODdDNXyUkfGD+bbDMICVwrnTOTvufrJVmrPbdfnMDr3WX84bxpto6XxGOmUmsn8= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1753077835573453.9919737791099; Sun, 20 Jul 2025 23:03:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1udjcC-0001rh-PB; Mon, 21 Jul 2025 02:03:09 -0400 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 1udjZA-0008IF-B5 for qemu-devel@nongnu.org; Mon, 21 Jul 2025 02:00:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1udjZ8-00069G-GR for qemu-devel@nongnu.org; Mon, 21 Jul 2025 01:59:59 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-605-PxqKhTIlOAyDV9TMgbsUXA-1; Mon, 21 Jul 2025 01:59:56 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 32AE319560AA; Mon, 21 Jul 2025 05:59:55 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.112.190]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8E55A195608D; Mon, 21 Jul 2025 05:59:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1753077597; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=r27fFDv0rcrOqMogFBb3ERRL57PzfIvzx8FWyvucAqo=; b=XbPxU9rCH3f+R/oiyvPYuBMGnkL2sFALW73M6ZSYqSemraxr80qZU1RCkH5QCZc2h/qxuV u97F0N6Qb2mtXkM5ez3jYBOYbxPQa5TwSvLpJ9q7HuXV0BawjOZuUT1++WZ/8F+rbiFTVW sNA+UqXG/4F9BKSFNvMh6U3tbRQaE6w= X-MC-Unique: PxqKhTIlOAyDV9TMgbsUXA-1 X-Mimecast-MFC-AGG-ID: PxqKhTIlOAyDV9TMgbsUXA_1753077595 From: Jason Wang To: qemu-devel@nongnu.org Cc: Laurent Vivier , Peter Maydell , Jason Wang Subject: [PULL 07/12] net/passt: Remove unused "err" from passt_vhost_user_event() (CID 1612375) Date: Mon, 21 Jul 2025 13:59:22 +0800 Message-ID: <20250721055927.75951-8-jasowang@redhat.com> In-Reply-To: <20250721055927.75951-1-jasowang@redhat.com> References: <20250721055927.75951-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=170.10.129.124; envelope-from=jasowang@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.088, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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 Precedence: list List-Id: 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 @redhat.com) X-ZM-MESSAGEID: 1753077836309116600 Content-Type: text/plain; charset="utf-8" From: Laurent Vivier The "err" variable was declared but never used within the passt_vhost_user_event() function. This resulted in a dead code warning (CID 1612375) from Coverity. Remove the unused variable and the associated error block to resolve the issue. Signed-off-by: Laurent Vivier Reviewed-by: Peter Maydell Signed-off-by: Jason Wang --- net/passt.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/net/passt.c b/net/passt.c index 6f616ba3c2..9cd5b3e6f2 100644 --- a/net/passt.c +++ b/net/passt.c @@ -397,7 +397,6 @@ err: static void passt_vhost_user_event(void *opaque, QEMUChrEvent event) { NetPasstState *s =3D opaque; - Error *err =3D NULL; =20 switch (event) { case CHR_EVENT_OPENED: @@ -428,10 +427,6 @@ static void passt_vhost_user_event(void *opaque, QEMUC= hrEvent event) /* Ignore */ break; } - - if (err) { - error_report_err(err); - } } =20 static int net_passt_vhost_user_init(NetPasstState *s, Error **errp) --=20 2.42.0 From nobody Sat Nov 15 08:50:43 2025 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1753077825; cv=none; d=zohomail.com; s=zohoarc; b=UhTbnrCIWZpq84jm4QMfVHwkRDlfhxhbKyFY5GEw7SOwQD0J0WIr6fyKs96LuA6GtC/WPfu0i/hg/x9ALQe7ujjb1+LJ2nLBHkMsp7Hr8j94Nc8dYmgB+lBaISsxjFt2gzcELLm05tg2Y+2ZMlZPJpJzr+1x/lRs7g4E1+vM2ns= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753077825; h=Content-Type: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=cBsUi8XmNS0xKJL2tpo8kexn1NzDc2Oho8vlTV6W80I=; b=SXQHGeYciMqgheKBhutMFRvXP+EvNy+a+dK5z3DKJoOawRtx5aRvOauCUzQ8tovvEdqZGKMlRNHgvkXWIBhUGTINPPF9r6YIiE832GYAvj6cowp+WtKzMZ6IhxT89dcPYIceFoC+8HVu6eMS65Lg7rTSeLoT6OIyMihk++CmqmA= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1753077825630480.0626396369023; Sun, 20 Jul 2025 23:03:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1udjbO-0001AK-Nm; Mon, 21 Jul 2025 02:02:22 -0400 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 1udjZJ-0008Lh-Sm for qemu-devel@nongnu.org; Mon, 21 Jul 2025 02:00:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1udjZD-0006AA-UR for qemu-devel@nongnu.org; Mon, 21 Jul 2025 02:00:08 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-163-h027qszGNnaXDoDuqL1fPw-1; Mon, 21 Jul 2025 01:59:59 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 72CDF1800282; Mon, 21 Jul 2025 05:59:58 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.112.190]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0C3FF195608D; Mon, 21 Jul 2025 05:59:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1753077601; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cBsUi8XmNS0xKJL2tpo8kexn1NzDc2Oho8vlTV6W80I=; b=UAFZrftFcCVF6aA69428TEyZHF+af+HCFPG5TXp+QifCPIopGoSFMHWhXHEXnn+NbBYjC1 zY+AhN13w6XXJZ0Rlh8tJvxRmkyOObDt785Y73Mm9GpCXH1A86A1Sj9jCUMuRR/7wLusnm /j3uTcxtZ1CTdfjSUvoWZYENcnJOCEw= X-MC-Unique: h027qszGNnaXDoDuqL1fPw-1 X-Mimecast-MFC-AGG-ID: h027qszGNnaXDoDuqL1fPw_1753077598 From: Jason Wang To: qemu-devel@nongnu.org Cc: Laurent Vivier , Peter Maydell , Jason Wang Subject: [PULL 08/12] net/vhost-user: Remove unused "err" from net_vhost_user_event() (CID 1612372) Date: Mon, 21 Jul 2025 13:59:23 +0800 Message-ID: <20250721055927.75951-9-jasowang@redhat.com> In-Reply-To: <20250721055927.75951-1-jasowang@redhat.com> References: <20250721055927.75951-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=170.10.129.124; envelope-from=jasowang@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.088, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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 Precedence: list List-Id: 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 @redhat.com) X-ZM-MESSAGEID: 1753077828055116600 Content-Type: text/plain; charset="utf-8" From: Laurent Vivier The "err" variable was declared but never used within the net_vhost_user_event() function. This resulted in a dead code warning (CID 1612372) from Coverity. Remove the unused variable and the associated error block to resolve the issue. Signed-off-by: Laurent Vivier Reviewed-by: Peter Maydell Signed-off-by: Jason Wang --- net/vhost-user.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/net/vhost-user.c b/net/vhost-user.c index 1c3b8b36f3..cec83e925f 100644 --- a/net/vhost-user.c +++ b/net/vhost-user.c @@ -329,7 +329,6 @@ static void net_vhost_user_event(void *opaque, QEMUChrE= vent event) NetClientState *ncs[MAX_QUEUE_NUM]; NetVhostUserState *s; Chardev *chr; - Error *err =3D NULL; int queues; =20 queues =3D qemu_find_net_clients_except(name, ncs, @@ -375,10 +374,6 @@ static void net_vhost_user_event(void *opaque, QEMUChr= Event event) /* Ignore */ break; } - - if (err) { - error_report_err(err); - } } =20 static int net_vhost_user_init(NetClientState *peer, const char *device, --=20 2.42.0 From nobody Sat Nov 15 08:50:43 2025 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1753078099; cv=none; d=zohomail.com; s=zohoarc; b=ncXnhqw2KmxSYvgTkjYz3YtspA9SHoRd0B60+199WS97isV6yV0g/pga8yL2+JxwzMJFbG9fuXIRqP9BVGktu+8nB0aBmtutYb4xJS/UFufM1GszfaRsQv3hIYv8S3BZRIu9sPdKdGR0ln9oVsPmzbafKLwlvarOVh0Y2c0VZ+Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753078099; h=Content-Type: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=mh9zgTuIoXCQjyZZkCH0tnuUy6UVCPeMbjt+eCrmLnY=; b=Mx81tCA8lqujFVWGZz1J9ud28Xabub3e8e/xJV8zzddbNgW1v9DspnCbc9hlFR80jGuUYiDLJJsD+XbvgF+uerjRkB0tl0MmA0ydTAne/AuCj2Sad2DbN4oZmQJinEOb7hDRySA6C5m4QaY9foIU00Ir7wpgWbnBbaq7Z050vBo= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1753078099644376.57081088132475; Sun, 20 Jul 2025 23:08:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1udjck-0002Fj-2i; Mon, 21 Jul 2025 02:03:47 -0400 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 1udjZJ-0008Lg-Lt for qemu-devel@nongnu.org; Mon, 21 Jul 2025 02:00:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1udjZG-0006MO-R2 for qemu-devel@nongnu.org; Mon, 21 Jul 2025 02:00:08 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-507-378weybHM0KAD52fy4sa0g-1; Mon, 21 Jul 2025 02:00:02 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 87F8B195FCC2; Mon, 21 Jul 2025 06:00:01 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.112.190]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 31CC5195608D; Mon, 21 Jul 2025 05:59:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1753077606; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mh9zgTuIoXCQjyZZkCH0tnuUy6UVCPeMbjt+eCrmLnY=; b=CX0+o5jFQRUGLOaROC5zHmJx4Eb6gJYAll8gu2CdNK9cnr4kZff01/r/ESTH2o94h/h2PE Mek8moNUwG5l8xq/RCj4cnqMxRjSZAG3T/blmF5WrxhC7w18qktsvMplwRhvqvsZCzpH9A tV5DUsfOhijF+QuTzNg4B8UpnEGIVLM= X-MC-Unique: 378weybHM0KAD52fy4sa0g-1 X-Mimecast-MFC-AGG-ID: 378weybHM0KAD52fy4sa0g_1753077601 From: Jason Wang To: qemu-devel@nongnu.org Cc: Laurent Vivier , Peter Maydell , Jason Wang Subject: [PULL 09/12] net/passt: Remove dead code in passt_vhost_user_start error path (CID 1612371) Date: Mon, 21 Jul 2025 13:59:24 +0800 Message-ID: <20250721055927.75951-10-jasowang@redhat.com> In-Reply-To: <20250721055927.75951-1-jasowang@redhat.com> References: <20250721055927.75951-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=170.10.129.124; envelope-from=jasowang@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.088, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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 Precedence: list List-Id: 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 @redhat.com) X-ZM-MESSAGEID: 1753078101093116600 Content-Type: text/plain; charset="utf-8" From: Laurent Vivier In passt_vhost_user_start(), if vhost_net_init() fails, the "net" variable is NULL and execution jumps to the "err:" label. The cleanup code within this label is conditioned on "if (net)", which can never be true in this error case. This makes the cleanup block dead code, as reported by Coverity (CID 1612371). Refactor the error handling to occur inline, removing the goto and the unreachable cleanup block. Signed-off-by: Laurent Vivier Reviewed-by: Peter Maydell Signed-off-by: Jason Wang --- net/passt.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/net/passt.c b/net/passt.c index 9cd5b3e6f2..ef59d0682b 100644 --- a/net/passt.c +++ b/net/passt.c @@ -375,7 +375,8 @@ static int passt_vhost_user_start(NetPasstState *s, Vho= stUserState *be) net =3D vhost_net_init(&options); if (!net) { error_report("failed to init passt vhost_net"); - goto err; + passt_vhost_user_stop(s); + return -1; } =20 if (s->vhost_net) { @@ -385,13 +386,6 @@ static int passt_vhost_user_start(NetPasstState *s, Vh= ostUserState *be) s->vhost_net =3D net; =20 return 0; -err: - if (net) { - vhost_net_cleanup(net); - g_free(net); - } - passt_vhost_user_stop(s); - return -1; } =20 static void passt_vhost_user_event(void *opaque, QEMUChrEvent event) --=20 2.42.0 From nobody Sat Nov 15 08:50:43 2025 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1753077790; cv=none; d=zohomail.com; s=zohoarc; b=Jh5ofwekJNHjioBMTZnCqy4o92wjVa5VN83shgo/mN/QE7PaET3IjMRv1Zh9w063vFcoAturcsq3ZZjy5paJ6MDjY8HY7Gj3G8kFYoAgE7vyC8UeHpc95nRWQ6FDTUiP7o1jl+IgH6j+5P4nQ87gt/ElyNSIJ4r2VnHNOuGuhUo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753077790; h=Content-Type: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=Azr2cluQxKXYj/39PD27Knk3I9DTPyWGGR88WltCJEM=; b=SYdQZqKd6NTwnazMaq9RBKphxnEUtRXkDGIMp3Q2UEVFgEuI15t0/1xc4FnlMQ7gbQkaja4/uaHUTWiG0TaPoYYKiMjni+SaTsMCarHhYdqgbjesGAF3CE9HvSWzOOOEqBe0HPY+wF86AbLZoEtxpmvNEusNFcBrhmKlmo76MOM= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1753077790193471.25778080659325; Sun, 20 Jul 2025 23:03:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1udjbB-0000pa-Nk; Mon, 21 Jul 2025 02:02:06 -0400 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 1udjZL-0008Ls-OH for qemu-devel@nongnu.org; Mon, 21 Jul 2025 02:00:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1udjZK-0006Mq-7u for qemu-devel@nongnu.org; Mon, 21 Jul 2025 02:00:11 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-311-fQj9bD1iMYCp0XpErAg2Zg-1; Mon, 21 Jul 2025 02:00:05 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9F5AA1800368; Mon, 21 Jul 2025 06:00:04 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.112.190]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 47F781956050; Mon, 21 Jul 2025 06:00:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1753077609; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Azr2cluQxKXYj/39PD27Knk3I9DTPyWGGR88WltCJEM=; b=TwakyZ9xXTnIh96XRzuBOd60lDyoOMS0zshD4nOxqpRwjnUzPVUYpk2NrP2tqjrIpZ05qh ulvxt2KU67KRYA7QCkHnut75unRrJYKuwMxY9wdOiZtyjFs5++FUvTIeTZHXd2od1z/SbG cybUYqBrTyZrc2FKfkIZiE/cSQ5VhzM= X-MC-Unique: fQj9bD1iMYCp0XpErAg2Zg-1 X-Mimecast-MFC-AGG-ID: fQj9bD1iMYCp0XpErAg2Zg_1753077604 From: Jason Wang To: qemu-devel@nongnu.org Cc: Laurent Vivier , Peter Maydell , Jason Wang Subject: [PULL 10/12] net/passt: Check return value of g_remove() in net_passt_cleanup() (CID 1612369) Date: Mon, 21 Jul 2025 13:59:25 +0800 Message-ID: <20250721055927.75951-11-jasowang@redhat.com> In-Reply-To: <20250721055927.75951-1-jasowang@redhat.com> References: <20250721055927.75951-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=170.10.129.124; envelope-from=jasowang@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.088, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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 Precedence: list List-Id: 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 @redhat.com) X-ZM-MESSAGEID: 1753077791961116600 Content-Type: text/plain; charset="utf-8" From: Laurent Vivier If g_remove() fails, use warn_report() to log an error. Signed-off-by: Laurent Vivier Reviewed-by: Peter Maydell Signed-off-by: Jason Wang --- net/passt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/passt.c b/net/passt.c index ef59d0682b..43c336e596 100644 --- a/net/passt.c +++ b/net/passt.c @@ -103,7 +103,10 @@ static void net_passt_cleanup(NetClientState *nc) #endif =20 kill(s->pid, SIGTERM); - g_remove(s->pidfile); + if (g_remove(s->pidfile) !=3D 0) { + warn_report("Failed to remove passt pidfile %s: %s", + s->pidfile, strerror(errno)); + } g_free(s->pidfile); g_ptr_array_free(s->args, TRUE); } --=20 2.42.0 From nobody Sat Nov 15 08:50:43 2025 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1753077728; cv=none; d=zohomail.com; s=zohoarc; b=VkvPXr9jsWwk6TkG0EOzlKXA//DQ9RDMROE2yDEDA33UQKHEAZJ6isdcyGa36/XXe1R/Q/TcYXHdxtq0ghkDyE9pnCazBxNY5zARPlvPkhbnN77EpZ0eAEOIQzpR7A+oVWVBW/9mlvHgxjkC6zMAgLOAOtQX+nYisbIt7jw5vFY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753077728; h=Content-Type: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=IDF+JFdowBa/PmuJ6B7AgL6OhHfe1s9R8UQbM+M3o5c=; b=EZedCfUcR8I7R5L7ANCXwqnnF9VSe2qx0mxNHySq4+wOFVQ41bKcqA0lS0bXcWmz6ibhnHG/N29AXKpWWVkAYoob5+xCUlEBKxiOi+ZyM12m6U94m/LMnyUY77yMBnnjK1R+3yzBNxCg6mutFvAaj0rhEWWApyP/e3txxvwIFeI= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1753077728395403.08095804624884; Sun, 20 Jul 2025 23:02:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1udjb3-0000TZ-1F; Mon, 21 Jul 2025 02:01:58 -0400 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 1udjZP-0008MK-BY for qemu-devel@nongnu.org; Mon, 21 Jul 2025 02:00:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1udjZL-0006Mx-Qi for qemu-devel@nongnu.org; Mon, 21 Jul 2025 02:00:13 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-251-AtgnmKqzNa-THtUEosUU0w-1; Mon, 21 Jul 2025 02:00:08 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B98DE1800C38; Mon, 21 Jul 2025 06:00:07 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.112.190]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5EF7419560AD; Mon, 21 Jul 2025 06:00:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1753077611; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IDF+JFdowBa/PmuJ6B7AgL6OhHfe1s9R8UQbM+M3o5c=; b=D5x1rUhcVbnGq0Tsji20nP/LFsW1gyFlcwkjZIG9q234OOx5ONxzZXWwoxLS2XLbeVJh7z mADDhz3vwtWjWozpWHYuIgrjTVvCSq5hc1/93VZa79UM1Anzu2BlThzoiQ8EroGeNlwka4 jjVS9GVChljHqsoIaQ4g4GUVJfzpqGc= X-MC-Unique: AtgnmKqzNa-THtUEosUU0w-1 X-Mimecast-MFC-AGG-ID: AtgnmKqzNa-THtUEosUU0w_1753077607 From: Jason Wang To: qemu-devel@nongnu.org Cc: Laurent Vivier , Peter Maydell , Jason Wang Subject: [PULL 11/12] net/passt: Initialize "error" variable in net_passt_send() (CID 1612368) Date: Mon, 21 Jul 2025 13:59:26 +0800 Message-ID: <20250721055927.75951-12-jasowang@redhat.com> In-Reply-To: <20250721055927.75951-1-jasowang@redhat.com> References: <20250721055927.75951-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=170.10.129.124; envelope-from=jasowang@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.088, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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 Precedence: list List-Id: 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 @redhat.com) X-ZM-MESSAGEID: 1753077729260116600 Content-Type: text/plain; charset="utf-8" From: Laurent Vivier This was flagged by Coverity as a memory illegal access. Initialize the pointer to NULL at declaration. Signed-off-by: Laurent Vivier Reviewed-by: Peter Maydell Signed-off-by: Jason Wang --- net/passt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/passt.c b/net/passt.c index 43c336e596..32ecffb763 100644 --- a/net/passt.c +++ b/net/passt.c @@ -124,7 +124,7 @@ static gboolean net_passt_send(QIOChannel *ioc, GIOCond= ition condition, { if (net_stream_data_send(ioc, condition, data) =3D=3D G_SOURCE_REMOVE)= { NetPasstState *s =3D DO_UPCAST(NetPasstState, data, data); - Error *error; + Error *error =3D NULL; =20 /* we need to restart passt */ kill(s->pid, SIGTERM); --=20 2.42.0 From nobody Sat Nov 15 08:50:43 2025 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1753078097; cv=none; d=zohomail.com; s=zohoarc; b=EVQYE94H9+snFnNjsDINzW1rbSY4C6qbQX9NKMW+g5GW7shRagN1vlRI1C20OemC3HY8hZrFDl3UDtfhrltnyKuVopqPSxBejBuPLHSz/ygrIwwhBV637T7HOaYcYJ+AzsBadXds8n3fP3sZOAq/OY2hltwthUbzaUlGav3/xz0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753078097; h=Content-Type: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=l7K46m3uw7Qx50uzdFY5CTZU3qbwCCpoVk+4+p3b3aI=; b=IV1Sn/1hzDGWDEXtWd8j9z46vI9z6nm8VVDKcvMFT9GFmfKij6kWXKKC3V3H6a1LfVSZpq2XUBKyP9Yl03oEnVxu8hE3ULsFgFjNrqov0QS/xNd7iVbSkEBXdRHaPh47y7CBs6xJwE1UFARapv2mMCvhUD7Ft/987BIX4KV/P3M= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1753078097578265.9766732547047; Sun, 20 Jul 2025 23:08:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1udjbD-0000xh-9t; Mon, 21 Jul 2025 02:02:07 -0400 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 1udjZR-0008NF-QI for qemu-devel@nongnu.org; Mon, 21 Jul 2025 02:00:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1udjZP-0006NC-VO for qemu-devel@nongnu.org; Mon, 21 Jul 2025 02:00:17 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-481-WqZ-NHGuP4iDEJWP7kjE8Q-1; Mon, 21 Jul 2025 02:00:11 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D686119560B6; Mon, 21 Jul 2025 06:00:10 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.112.190]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 79A5C195608D; Mon, 21 Jul 2025 06:00:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1753077615; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l7K46m3uw7Qx50uzdFY5CTZU3qbwCCpoVk+4+p3b3aI=; b=VsQp6n4GxthR8j8aWm4hO2VOMwKW+TgX18gtRFDWGx1hj+Kp3Po5Lp1hG7i9NHTTsjpUio Tgzac2AmNhdxYYhVcJygG2kK8dl1lANOXkO4V33XnKGZcIWeH1z+6J1dQIqea+iwnmI1Ug 9aplGruD9NBAUs9Yq5e2wObPfWD+hj0= X-MC-Unique: WqZ-NHGuP4iDEJWP7kjE8Q-1 X-Mimecast-MFC-AGG-ID: WqZ-NHGuP4iDEJWP7kjE8Q_1753077611 From: Jason Wang To: qemu-devel@nongnu.org Cc: Laurent Vivier , Peter Maydell , Jason Wang Subject: [PULL 12/12] net/vhost-user: Remove unused "err" from chr_closed_bh() (CID 1612365) Date: Mon, 21 Jul 2025 13:59:27 +0800 Message-ID: <20250721055927.75951-13-jasowang@redhat.com> In-Reply-To: <20250721055927.75951-1-jasowang@redhat.com> References: <20250721055927.75951-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=170.10.129.124; envelope-from=jasowang@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.088, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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 Precedence: list List-Id: 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 @redhat.com) X-ZM-MESSAGEID: 1753078098952116600 Content-Type: text/plain; charset="utf-8" From: Laurent Vivier The "err" variable was declared but never used within the chr_closed_bh() function. This resulted in a dead code warning (CID 1612365) from Coverity. Remove the unused variable and the associated error block to resolve the issue. Signed-off-by: Laurent Vivier Reviewed-by: Peter Maydell Signed-off-by: Jason Wang --- net/vhost-user.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/net/vhost-user.c b/net/vhost-user.c index cec83e925f..8b96157145 100644 --- a/net/vhost-user.c +++ b/net/vhost-user.c @@ -298,7 +298,6 @@ static void chr_closed_bh(void *opaque) const char *name =3D opaque; NetClientState *ncs[MAX_QUEUE_NUM]; NetVhostUserState *s; - Error *err =3D NULL; int queues, i; =20 queues =3D qemu_find_net_clients_except(name, ncs, @@ -317,9 +316,6 @@ static void chr_closed_bh(void *opaque) qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, net_vhost_user_event, NULL, opaque, NULL, true); =20 - if (err) { - error_report_err(err); - } qapi_event_send_netdev_vhost_user_disconnected(name); } =20 --=20 2.42.0