From nobody Tue Feb 10 22:18:35 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1696592382; cv=none; d=zohomail.com; s=zohoarc; b=mOpD3c6D75fORJZi8FnkQbgVzM5M7DckF5x9bNY66kHlCQrqxdB88lmwDuGAQHiDg9XRi945gAhRV6fWdJ/r4XCO03Gbc4zdIlEvYNalffZbfM4crBFKmAAswjXWBOCmXM03BSvAvEYnwX1YTHO5yfDNfvZjqHNUFA4GqfdpBuQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696592382; 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=8Wjqy/b5KUIIyv5+VdfsykcttIE6ok1OTGxheaSCnq0=; b=G/UbjsrTtPwxzRpBMWSqqWnFjj/XunTExkKMfx4ya3s6SF2OZ9rrHm2UoXnLUSxugbPOV/i6lyVPUclJ3/vOjse7dltG1QPqjdi+Be485PWgvjHafxnF98R6A//r9/qlXAotbY2uUuTSMN+GDixDkIhsRHv80mESPzq+o18z+70= 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 1696592382022737.7476406325721; Fri, 6 Oct 2023 04:39:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qoj9I-000589-TD; Fri, 06 Oct 2023 07:37:40 -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 1qoj8u-00050r-8b for qemu-devel@nongnu.org; Fri, 06 Oct 2023 07:37:16 -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 1qoj8o-00008v-6h for qemu-devel@nongnu.org; Fri, 06 Oct 2023 07:37:15 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-533-4G_BT-mjMNebQrbrUfpbng-1; Fri, 06 Oct 2023 07:37:00 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AACAA3827DE8; Fri, 6 Oct 2023 11:36:59 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8A363140E953; Fri, 6 Oct 2023 11:36:59 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 68EA521E6910; Fri, 6 Oct 2023 13:36:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696592228; 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=8Wjqy/b5KUIIyv5+VdfsykcttIE6ok1OTGxheaSCnq0=; b=DM9DGn564Ryg4objH1K0ue9EyOpYF79m3H75XkqQ/p3zDRGMUiqBzwdTIx28ddR8J9VCIR xTNPZgIN7H/Ka8C69XW4MsmT6BwgiicHLc9TBBueY82Fh5Y5hGR0TuMzDo2rvPBJuPwCJa FgPuM749N9EEHHxPJ9TSWuyGOY0jF8Q= X-MC-Unique: 4G_BT-mjMNebQrbrUfpbng-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 07/32] hw/virtio/virtio-pci: Avoid compiler warning with -Wshadow Date: Fri, 6 Oct 2023 13:36:32 +0200 Message-ID: <20231006113657.3803180-8-armbru@redhat.com> In-Reply-To: <20231006113657.3803180-1-armbru@redhat.com> References: <20231006113657.3803180-1-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com 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, DKIMWL_WL_HIGH=-0.001, 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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 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: 1696592383039100005 From: Thomas Huth "len" is used as parameter of the functions virtio_write_config() and virtio_read_config(), and additionally as a local variable, so this causes a compiler warning when compiling with "-Wshadow" and can be confusing for the reader. Rename the local variables to "caplen" to avoid this problem. Signed-off-by: Thomas Huth Message-ID: <20231004095302.99037-1-thuth@redhat.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Markus Armbruster --- hw/virtio/virtio-pci.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index edbc0daa18..abebd0075a 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -780,15 +780,15 @@ static void virtio_write_config(PCIDevice *pci_dev, u= int32_t address, pci_cfg_= data), sizeof cfg->pci_cfg_data)) { uint32_t off; - uint32_t len; + uint32_t caplen; =20 cfg =3D (void *)(proxy->pci_dev.config + proxy->config_cap); off =3D le32_to_cpu(cfg->cap.offset); - len =3D le32_to_cpu(cfg->cap.length); + caplen =3D le32_to_cpu(cfg->cap.length); =20 - if (len =3D=3D 1 || len =3D=3D 2 || len =3D=3D 4) { - assert(len <=3D sizeof cfg->pci_cfg_data); - virtio_address_space_write(proxy, off, cfg->pci_cfg_data, len); + if (caplen =3D=3D 1 || caplen =3D=3D 2 || caplen =3D=3D 4) { + assert(caplen <=3D sizeof cfg->pci_cfg_data); + virtio_address_space_write(proxy, off, cfg->pci_cfg_data, capl= en); } } } @@ -804,15 +804,15 @@ static uint32_t virtio_read_config(PCIDevice *pci_dev, pci_cfg_= data), sizeof cfg->pci_cfg_data)) { uint32_t off; - uint32_t len; + uint32_t caplen; =20 cfg =3D (void *)(proxy->pci_dev.config + proxy->config_cap); off =3D le32_to_cpu(cfg->cap.offset); - len =3D le32_to_cpu(cfg->cap.length); + caplen =3D le32_to_cpu(cfg->cap.length); =20 - if (len =3D=3D 1 || len =3D=3D 2 || len =3D=3D 4) { - assert(len <=3D sizeof cfg->pci_cfg_data); - virtio_address_space_read(proxy, off, cfg->pci_cfg_data, len); + if (caplen =3D=3D 1 || caplen =3D=3D 2 || caplen =3D=3D 4) { + assert(caplen <=3D sizeof cfg->pci_cfg_data); + virtio_address_space_read(proxy, off, cfg->pci_cfg_data, caple= n); } } =20 --=20 2.41.0