From nobody Mon Apr 29 18:45:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1685458961; cv=none; d=zohomail.com; s=zohoarc; b=QO2BEx5utryuC7za7C68QDYf6Tu7yNxxglDBz3ryBjFA2qEEfHQAzBhCGmqEbtUAvvYglooNCIqk5d8Pn/6STpMcCYlg2TOzVnOKjm+kzSXeLYTWdmWEJ5vEIdVMwmjZuZ0GFi6gt55JqgttzdDwQqW9374mbFi6IVUGUU0rOsY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685458961; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=QXLEZv3TkRfh07MgbmKAR1K5IQRkHNXdfEuBVttEtHo=; b=oFyfyHcHKP0ZEtJYHgkt5zA3a02A9HGVYX4fn8MkbEXYa+4kTmCeU79vNF/0Uy5vCgFEbaLRFOcuaqbF1Yblg5+chPRmFdRp9E4Dju0ftHMToc+HivXQiJ9TOs1+S4QSotkuOg6S7CXss1X7qa/by/6+JxeOB2OwinW+pJWHE0c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1685458961875529.4637825361871; Tue, 30 May 2023 08:02:41 -0700 (PDT) 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-219-hp2LJJoYNRCiNnXsRGP3dQ-1; Tue, 30 May 2023 11:02:36 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B34A6101B041; Tue, 30 May 2023 15:02:32 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9EDFAC154D3; Tue, 30 May 2023 15:02:30 +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 39CA519465A0; Tue, 30 May 2023 15:02:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2FBDE1946595 for ; Tue, 30 May 2023 15:02:29 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 0DEAD112132D; Tue, 30 May 2023 15:02:29 +0000 (UTC) Received: from fedora.. (unknown [10.43.2.118]) by smtp.corp.redhat.com (Postfix) with ESMTP id A9D39112132C for ; Tue, 30 May 2023 15:02:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685458960; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=QXLEZv3TkRfh07MgbmKAR1K5IQRkHNXdfEuBVttEtHo=; b=AWXfCFpO94x190ces6IqqAmY8kS9fPqZR+KjEYOlq8k5TRQLNSjBoXYcfHBONs5rY0jCbm prXh5hv0nJ829f/Q3UHDJLZQRPiW2rUq4p3GTmRnPMk8pk8jCEqyaEKmsyWNuiFwSj7mjr coCLIFKOw8wPThSXtyWgS/DT2AmPhhI= X-MC-Unique: hp2LJJoYNRCiNnXsRGP3dQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH] conf: node_device: use separate variable for parsing an integer Date: Tue, 30 May 2023 17:02:26 +0200 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1685458963232100001 In virNodeDeviceGetSCSIHostCaps, there is a pattern of reusing a tmp value and stealing the pointer. But in one case it is not stolen. Use a separate variable for it to avoid mixing autofree with manual free() calls. Fixes: 8a0cb5f73ade3900546718eabe70cb064c6bd22c Signed-off-by: J=C3=A1n Tomko --- src/conf/node_device_conf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index fcee9c027c..2c98844c47 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -2858,15 +2858,16 @@ virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHost = *scsi_host) =20 if (virVHBAIsVportCapable(NULL, scsi_host->host)) { scsi_host->flags |=3D VIR_NODE_DEV_CAP_FLAG_HBA_VPORT_OPS; + g_autofree char *max_vports =3D NULL; =20 - if (!(tmp =3D virVHBAGetConfig(NULL, scsi_host->host, + if (!(max_vports =3D virVHBAGetConfig(NULL, scsi_host->host, "max_npiv_vports"))) { VIR_WARN("Failed to read max_npiv_vports for host%d", scsi_host->host); goto cleanup; } =20 - if (virStrToLong_i(tmp, NULL, 10, &scsi_host->max_vports) < 0) { + if (virStrToLong_i(max_vports, NULL, 10, &scsi_host->max_vports) <= 0) { VIR_WARN("Failed to parse value of max_npiv_vports '%s'", tmp); goto cleanup; } --=20 2.40.1