From nobody Mon Feb 9 09:47:20 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1668589994; cv=none; d=zohomail.com; s=zohoarc; b=gBMGufVoJEf9t4Av8J+gEguIYQOrhCHKsKlpPwWkYr0lFlpojUtePXedFEYwoRnXjEBw+W6EJzecWk6CWsMS5ogJDGhyeRqL6N4q7o70+EzzA+ddY/8duFizJdRJCYAJZ96I5Mmhj6TDP6CI84n/rclH+UIqkEYxrnRs1qTYGa4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1668589994; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MhPb5nMe5XIqt6MfZFLoiJ8EYxiiniUC5yp5BF5+kQg=; b=dwcMJn0leC58kmBnIrQ3tUA/SWrxBw3XkdIo0e9sgVfQSUbQBDIlr2ycgyWWvhmx+sgv5rUVTK9B4LhoC5vPCIakVDXiWwkkHlKOccTmQSDK3Ewb+1reMbaBlPhBvqoeQxRgtUQtC0R+GgnE1cpJ7EhY/of6VxJnpo4HeJZp/sU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1668589994470212.0584364774511; Wed, 16 Nov 2022 01:13:14 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-90-ZKAXywrdOuC9u5PSoGw83A-1; Wed, 16 Nov 2022 04:12:01 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 329A718F0242; Wed, 16 Nov 2022 09:11:57 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1D44C4EA59; Wed, 16 Nov 2022 09:11:57 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0B48F1946A73; Wed, 16 Nov 2022 09:11:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A6C5D19465B7 for ; Wed, 16 Nov 2022 09:11:53 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 14E9540C83EB; Wed, 16 Nov 2022 09:11:50 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id AE21840C83D9 for ; Wed, 16 Nov 2022 09:11:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668589993; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=MhPb5nMe5XIqt6MfZFLoiJ8EYxiiniUC5yp5BF5+kQg=; b=Cd6EqvADaZU2TWSBSQp0pVvccw3z8oOxQcR8Uglw9oLIuQgGtHM17ltyYlbxiqOsDlsZwr oTA6NzlO2XSVOcv3N8gpwike6QzzcF0E766/nhhDA/bCNukDbk3mZjFiYbPxw1hKVlEmhL oXQA28Xu72N85xXWqWNz9Bq4NQ73g6Y= X-MC-Unique: ZKAXywrdOuC9u5PSoGw83A-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 5/7] vmx: Rework virVMXConfigScanResultsCollector slightly Date: Wed, 16 Nov 2022 10:11:43 +0100 Message-Id: <0eaf784a9bb6d6694ca722cb6278044a4a86e7b6.1668589451.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1668589995127100002 Content-Type: text/plain; charset="utf-8"; x-default="true" The idea here is that virVMXConfigScanResultsCollector() sets the networks_max_index to the highest ethernet index seen. Well, the struct member is signed int, we parse just seen index into uint and then typecast to compare the two. This is not necessary, because the maximum number of NICs a vSphere domain can have is (): ten [1]. This will fit into signed int easily anywhere. 1: https://configmax.esp.vmware.com/guest?vmwareproduct=3DvSphere&release= =3DvSphere%208.0&categories=3D1-0 Signed-off-by: Michal Privoznik --- src/vmx/vmx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index d3e452e3ef..287a877b4a 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -1324,10 +1324,10 @@ virVMXConfigScanResultsCollector(const char* name, const char *suffix =3D NULL; =20 if ((suffix =3D STRCASESKIP(name, "ethernet"))) { - unsigned int idx; + int idx; char *p; =20 - if (virStrToLong_uip(suffix, &p, 10, &idx) < 0 || + if (virStrToLong_i(suffix, &p, 10, &idx) < 0 || *p !=3D '.') { virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to parse the index of the VMX key '%s= '"), @@ -1335,8 +1335,8 @@ virVMXConfigScanResultsCollector(const char* name, return -1; } =20 - if ((int)idx > results->networks_max_index) - results->networks_max_index =3D (int)idx; + if (idx > results->networks_max_index) + results->networks_max_index =3D idx; } =20 return 0; --=20 2.37.4