From nobody Sat May 18 13:16:20 2024 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=1693396790; cv=none; d=zohomail.com; s=zohoarc; b=m4AmZG3UNgTTcr7Q3NJDc4cnGTHORNwG8pTRB79M08TT8olBoQZywA1HmTzaGuQfNJzVfskUOmsBfvPZYhP63eIYwYk2kvRpN4+kv9pdh7F+8fiJhChFdhHT4c4X3KjMOXSDV8AXd4nU8PghNbcNtqWZrOnf2ZNCMEgwqavkKfc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693396790; 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=eatUEwnWRJInLV1GMaeEwBUH9YPR7HPBOaWnxrS/6vM=; b=ioCMkewh6T54/1ZrLsNG9b0VvuP239G/bDtj1QNcCnnv5iP28du77QJFKKY8r2nRH04OMKR9bATU1z6KpRHvoBW5DTpwLgCPlmjZ+dob6hvKqLQDWdOwnU3mUL0HgV783VmLt9mobCOzP3Oug2FK3V+y5XVQH7v58zX82WZJWT0= 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 1693396790454646.335054650417; Wed, 30 Aug 2023 04:59:50 -0700 (PDT) Received: from mimecast-mx02.redhat.com (66.187.233.73 [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-464-V9IIn2__Mj65siFa8-tsEg-1; Wed, 30 Aug 2023 07:59:47 -0400 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 527FC1C06ED0; Wed, 30 Aug 2023 11:59:45 +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 3D77C6B2A9; Wed, 30 Aug 2023 11:59:45 +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 771C519452C6; Wed, 30 Aug 2023 11:59:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B0AD619451D1 for ; Wed, 30 Aug 2023 11:59:29 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 806F2C15BB8; Wed, 30 Aug 2023 11:59:24 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A107C15BAE for ; Wed, 30 Aug 2023 11:59:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693396789; 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=eatUEwnWRJInLV1GMaeEwBUH9YPR7HPBOaWnxrS/6vM=; b=bfUZNamKIixc8vtACV+zv7w95jElNK9M6Yur2lkMDT22XIcTjRmjr4q/GH+XXys/g9rs2r DTeWg1l2fpxzAn5T+0edVrzDaY7MdjRJzmnvp8cjU3mE1brS/dQ4NwPAJm6lUUn8oVKNye 6hZ25fIXryJGakoSmR7MPjFZqfYQn5w= X-MC-Unique: V9IIn2__Mj65siFa8-tsEg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/8] bhyve: Don't stack-allocate huge error buffers Date: Wed, 30 Aug 2023 13:59:15 +0200 Message-ID: <7540a560c815562d32dae97b7c899b9d76b9071e.1693396633.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: 1693396790694100005 Content-Type: text/plain; charset="utf-8" _POSIX2_LINE_MAX is 2048. Allocate the buffers on the heap instead. Signed-off-by: Peter Krempa Reviewed-by: Kristina Hanicova --- src/bhyve/bhyve_process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c index 80d5a8804f..c8e1a10afe 100644 --- a/src/bhyve/bhyve_process.c +++ b/src/bhyve/bhyve_process.c @@ -380,7 +380,7 @@ virBhyveGetDomainTotalCpuStats(virDomainObj *vm, { struct kinfo_proc *kp; kvm_t *kd; - char errbuf[_POSIX2_LINE_MAX]; + g_autofree char *errbuf =3D g_new0(char, _POSIX2_LINE_MAX); int nprocs; int ret =3D -1; @@ -481,7 +481,7 @@ virBhyveProcessReconnectAll(struct _bhyveConn *driver) { kvm_t *kd; struct bhyveProcessReconnectData data; - char errbuf[_POSIX2_LINE_MAX]; + g_autofree char *errbuf =3D g_new0(char, _POSIX2_LINE_MAX); if ((kd =3D kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf)) =3D=3D = NULL) { virReportError(VIR_ERR_SYSTEM_ERROR, --=20 2.41.0 From nobody Sat May 18 13:16:20 2024 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=1693396783; cv=none; d=zohomail.com; s=zohoarc; b=G+p0TEs3rKRVqEBNJX0BjfxA8ovPuM/7NZkmKmJOm7UeRmSKdVvQ98G0k7QI0zUYq2GN5SKHKVRGGRcJFMgkip4YlSvTW8qLM4HuC5yZZo0GK6HSVksz43BhFesbmH+lGnxObjk8KYT+2Qk4s6ANmLuKfJK5kWHYRqFG7sSDyv0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693396783; 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=YGyTp+LpM2sEZldnCE4o2YEFLMTCtNygL488Y+xZfxc=; b=QEv2K9xqYP1tEJeMce0YtPKthvDmdblGrQk8w5EFe0rSAepTfIXleBdKohrJR3AuIWgCXmm6sKuPInTak4O8YB4Jm7tvLm+sH7iUkkM4I4rhMnGdGj5hhhn4lFprgpNEaDyTEMz2dS2N80fklzylYf2cpBZf4XgGhI163BmVX6w= 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 1693396783837555.4601480235059; Wed, 30 Aug 2023 04:59:43 -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-468-06mWdoBbNrKw1BTownWs-w-1; Wed, 30 Aug 2023 07:59:36 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0D2D5805F5B; Wed, 30 Aug 2023 11:59:34 +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 BEBD72166B25; Wed, 30 Aug 2023 11:59:33 +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 9F64B19465A2; Wed, 30 Aug 2023 11:59:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 77FD71946A43 for ; Wed, 30 Aug 2023 11:59:25 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 6439FC15BC0; Wed, 30 Aug 2023 11:59:25 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id D7B69C15BAE for ; Wed, 30 Aug 2023 11:59:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693396782; 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=YGyTp+LpM2sEZldnCE4o2YEFLMTCtNygL488Y+xZfxc=; b=Rh7+R2TXcjeouUZ7XgPuleVvBRAWx0gAcxlnHYgtkGpBRJN/GyWcF9Ryi+SrraKLrRvnzo FhOg3i+H82XiHMAWsveXQod5s9t9aUJy4Vz332Mk+x9FOqNPySnbns9pqk0gBbrl4rWUDb JOjgR+Amc8YAdVQME4E8sYcukzwEM78= X-MC-Unique: 06mWdoBbNrKw1BTownWs-w-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/8] virHostValidateBhyve: Declare one variable per line Date: Wed, 30 Aug 2023 13:59:16 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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.6 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: 1693396784694100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: Kristina Hanicova --- tools/virt-host-validate-bhyve.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/virt-host-validate-bhyve.c b/tools/virt-host-validate-bh= yve.c index a39225016d..9457fac9a5 100644 --- a/tools/virt-host-validate-bhyve.c +++ b/tools/virt-host-validate-bhyve.c @@ -50,8 +50,10 @@ int virHostValidateBhyve(void) int ret =3D 0; int fileid =3D 0; struct kld_file_stat stat; - bool vmm_loaded =3D false, if_tap_loaded =3D false; - bool if_bridge_loaded =3D false, nmdm_loaded =3D false; + bool vmm_loaded =3D false; + bool if_tap_loaded =3D false; + bool if_bridge_loaded =3D false; + bool nmdm_loaded =3D false; for (fileid =3D kldnext(0); fileid > 0; fileid =3D kldnext(fileid)) { stat.version =3D sizeof(struct kld_file_stat); --=20 2.41.0 From nobody Sat May 18 13:16:20 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=1693396786; cv=none; d=zohomail.com; s=zohoarc; b=HAOMHy44zXr9KwEVBJCT9vXo4R543DdBn+uahYincqTqgl4aWEhYkd9qyK6j5HarxtxQbiBkKQ/Zd9XfkH39Z4K7R9FWrY40QhW7i2dn05oeSheJuH64VnyqGT0AVD8hjDnuHQgaNbyPh/PYZ/4pWC6etzE87tHIGnKFNG5/GBc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693396786; 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=M/3ZKqM5ErMobw3fSBXw1ZATzkEeT45zb+Uaon0x6fc=; b=h2kUoftLRtyqPpIuhw/4J3GXIeHN+9KewixD8kwgBkoR/ogpCMWXx4BgJQslYAsmsP1Q5Q+k6i9rYZPXxXXm5ouA2P5Uk+od24UveBqRydnsYsaIs+4aMdpSPicWjl8BeakREoevUwYzlxNNn9P8QuU8Wxmzz3wqMSeJX1mY9pM= 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 1693396786932141.61317165325124; Wed, 30 Aug 2023 04:59:46 -0700 (PDT) Received: from mimecast-mx02.redhat.com (66.187.233.73 [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-317-KZFM06sDMYOwxUIwR5RxFg-1; Wed, 30 Aug 2023 07:59:42 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 415391C06ED0; Wed, 30 Aug 2023 11:59:40 +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 2F4FC40C6F4C; Wed, 30 Aug 2023 11:59:40 +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 D3E5A1946A4B; Wed, 30 Aug 2023 11:59:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6AEA51946589 for ; Wed, 30 Aug 2023 11:59:26 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 4FD07C15BC0; Wed, 30 Aug 2023 11:59:26 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4B0DC15BAE for ; Wed, 30 Aug 2023 11:59:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693396785; 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=M/3ZKqM5ErMobw3fSBXw1ZATzkEeT45zb+Uaon0x6fc=; b=BLbzvnaHySZ3GTFOu0pT51zx0wQO2M453FNQNC+I9PB6OlMFmuYG5K526edHgFKd6pTFD7 86tG/DQzjP0GRurLGWPztUEbWiQdLsE0Ky81WhsragEfg/Qdk8r+f0NKhooRL4GY7ILRx2 zulhzlXOJH+vyZi6swQdmBIR/079VhY= X-MC-Unique: KZFM06sDMYOwxUIwR5RxFg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/8] virHostValidateBhyve: Heap allocate massive 'struct kld_file_stat' Date: Wed, 30 Aug 2023 13:59:17 +0200 Message-ID: <8f8646767b3bc19a023a1bdc1ae9d69e7fcae37a.1693396633.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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.2 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: 1693396788607100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: Kristina Hanicova --- tools/virt-host-validate-bhyve.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/virt-host-validate-bhyve.c b/tools/virt-host-validate-bh= yve.c index 9457fac9a5..db1cdd8e2c 100644 --- a/tools/virt-host-validate-bhyve.c +++ b/tools/virt-host-validate-bhyve.c @@ -49,24 +49,24 @@ int virHostValidateBhyve(void) { int ret =3D 0; int fileid =3D 0; - struct kld_file_stat stat; + g_autofree struct kld_file_stat *stat =3D g_new0(struct kld_file_stat,= 1); bool vmm_loaded =3D false; bool if_tap_loaded =3D false; bool if_bridge_loaded =3D false; bool nmdm_loaded =3D false; for (fileid =3D kldnext(0); fileid > 0; fileid =3D kldnext(fileid)) { - stat.version =3D sizeof(struct kld_file_stat); - if (kldstat(fileid, &stat) < 0) + stat->version =3D sizeof(struct kld_file_stat); + if (kldstat(fileid, stat) < 0) continue; - if (STREQ(stat.name, "vmm.ko")) + if (STREQ(stat->name, "vmm.ko")) vmm_loaded =3D true; - else if (STREQ(stat.name, "if_tap.ko")) + else if (STREQ(stat->name, "if_tap.ko")) if_tap_loaded =3D true; - else if (STREQ(stat.name, "if_bridge.ko")) + else if (STREQ(stat->name, "if_bridge.ko")) if_bridge_loaded =3D true; - else if (STREQ(stat.name, "nmdm.ko")) + else if (STREQ(stat->name, "nmdm.ko")) nmdm_loaded =3D true; } --=20 2.41.0 From nobody Sat May 18 13:16:20 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=1693396782; cv=none; d=zohomail.com; s=zohoarc; b=LH+A3U5z89V7xVb5QVinYhrB69+W1E9ijwP36cZp8FoEv5lgx35jjV921OGyAU6jvssCjYG0hFqrcI87ic0XLpL13D6xabaIcUL6ljREljfP+EL0qw0S4GVxadRZM7B6GoHYs6Rl11deiyJGJ/wCG1vroeWd1qLsh0K4UHxJ2hQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693396782; 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=YZFKZN1ASBuQOjSJiV9i1LScpeK07jGaMj/cmG+mMaQ=; b=jhcF0GBKw0KfnVuBfHqCkDei+IcZwcxm2P8dOTGnDhVyWL4Gy50uhGZ7eCSuLieExt9hsnXVlxXEYsn4inB2bXyL/6737JporZg4LgtQj50AgtR1Hrf99av/3Aq9vhH+ugN7wUkCfDwBqpitSJNsgL7iOd5PMxvATorWD+nQDh8= 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 1693396782460858.3948782906682; Wed, 30 Aug 2023 04:59:42 -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-479-so0n4mBZM56eJ2pCrrfO8A-1; Wed, 30 Aug 2023 07:59:35 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AB56185D06D; Wed, 30 Aug 2023 11:59:33 +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 9977C2166B26; Wed, 30 Aug 2023 11:59:33 +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 E667419452C5; Wed, 30 Aug 2023 11:59:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 5896A19452C5 for ; Wed, 30 Aug 2023 11:59:27 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 54064C15BC0; Wed, 30 Aug 2023 11:59:27 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA551C15BAE for ; Wed, 30 Aug 2023 11:59:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693396781; 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=YZFKZN1ASBuQOjSJiV9i1LScpeK07jGaMj/cmG+mMaQ=; b=SRoE3fa7sjW5LjHyaKmOtMP/ASXKL5gXP9ethyJSes5Ye8s2ImAtLRiK4jB/Q40B5Ic9pl +AA7fMaN9e8bjR5VWBYPwMZCpkoAunq2zijMI63qjyLMKpCAe7VCEBl4u0FdMk9SaMeETO VzJ7toAcT5w/tG6QkFAaXsi6c0UC+T4= X-MC-Unique: so0n4mBZM56eJ2pCrrfO8A-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 4/8] nss: aiforaf: Format one argument/variable per line Date: Wed, 30 Aug 2023 13:59:18 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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.6 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: 1693396784421100001 Content-Type: text/plain; charset="utf-8" Break up the argument and variable declarations to the preferred style. Signed-off-by: Peter Krempa Reviewed-by: Kristina Hanicova --- tools/nss/libvirt_nss.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/nss/libvirt_nss.c b/tools/nss/libvirt_nss.c index b028f28608..cd2b8feb5a 100644 --- a/tools/nss/libvirt_nss.c +++ b/tools/nss/libvirt_nss.c @@ -464,13 +464,19 @@ ns_mtab methods[] =3D { }; static void -aiforaf(const char *name, int af, struct addrinfo *pai, struct addrinfo **= aip) +aiforaf(const char *name, + int af, + struct addrinfo *pai, + struct addrinfo **aip) { int ret; struct hostent resolved; char buf[1024] =3D { 0 }; - int err, herr; - struct addrinfo hints, *res0, *res; + int err; + int herr; + struct addrinfo hints; + struct addrinfo *res0; + struct addrinfo *res; char **addrList; if ((ret =3D NSS_NAME(gethostbyname2)(name, af, &resolved, --=20 2.41.0 From nobody Sat May 18 13:16:20 2024 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=1693396788; cv=none; d=zohomail.com; s=zohoarc; b=f9YYabKtZ16TX0uY/W2qQ3hLIaxKD13GYZLLqV+XPC020APVXt5D9Cxda4cZjc7FVWH8TwMFoMNzPlFzGd8enhN1bejpxfIB5kDU1KFf182JJJh137fRH+Qv07ipm+2O4RzDlQkR6/zFi8gYGQsX+REtLPB8JDGwjBk7M9m4Gzw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693396788; 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=Xt+oEQT4rZ0MxhSPXSTzm0QLHqFQ/EwNnNNT4TF4MmA=; b=CdfWyB0p62ZWrcbiXuq+xUvN4zePQFdMiu7Va2JAjWiEvR4vvMIbZWTUnxOhyVb0icFwZZ5LoEDl1YhS0nNOckIsvC8EoVPhXovbRZ2bzkr5O/zYGsre4MkEwWUVzr8wx8uPZVwKxrOtd9jc90l0f6KP9jGO4om1G8et871XCRM= 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 1693396788513715.2881880548457; Wed, 30 Aug 2023 04:59:48 -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-258-ziMUKp3JP_eYLL1KWFUHQA-1; Wed, 30 Aug 2023 07:59:42 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CDD08823D5E; Wed, 30 Aug 2023 11:59:39 +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 BC9832166B25; Wed, 30 Aug 2023 11:59:39 +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 45F181946594; Wed, 30 Aug 2023 11:59:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6CB0F1946A4A for ; Wed, 30 Aug 2023 11:59:28 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 6839BC15BC0; Wed, 30 Aug 2023 11:59:28 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4859C15BAE for ; Wed, 30 Aug 2023 11:59:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693396787; 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=Xt+oEQT4rZ0MxhSPXSTzm0QLHqFQ/EwNnNNT4TF4MmA=; b=U99GB7ezPKBBLCPvnec+NBmawED5avVyqiFcbmyNDn8dTqZoiRF0cLvpO6Qc/70R5Oz/IC 9YWbYCbKbXO7Y8DABhcDV35GvL4C4tTFFxZrJVP+gad/nESEUlFJdnPXBPwSleqQUdkUH1 6idhrqMr7VYUCNZJDdxbl/doMqlBh48= X-MC-Unique: ziMUKp3JP_eYLL1KWFUHQA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 5/8] nss: aiforaf: Remove unused 'ret' variable Date: Wed, 30 Aug 2023 13:59:19 +0200 Message-ID: <56d3158a4cfb026771cdbc73c557d3f6c09877d7.1693396633.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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.6 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: 1693396788815100003 Content-Type: text/plain; charset="utf-8" The variable is set but never actually used. Signed-off-by: Peter Krempa Reviewed-by: Kristina Hanicova --- tools/nss/libvirt_nss.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/nss/libvirt_nss.c b/tools/nss/libvirt_nss.c index cd2b8feb5a..faa44e78df 100644 --- a/tools/nss/libvirt_nss.c +++ b/tools/nss/libvirt_nss.c @@ -469,7 +469,6 @@ aiforaf(const char *name, struct addrinfo *pai, struct addrinfo **aip) { - int ret; struct hostent resolved; char buf[1024] =3D { 0 }; int err; @@ -479,9 +478,9 @@ aiforaf(const char *name, struct addrinfo *res; char **addrList; - if ((ret =3D NSS_NAME(gethostbyname2)(name, af, &resolved, - buf, sizeof(buf), - &err, &herr)) !=3D NS_SUCCESS) + if (NSS_NAME(gethostbyname2)(name, af, &resolved, + buf, sizeof(buf), + &err, &herr) !=3D NS_SUCCESS) return; addrList =3D resolved.h_addr_list; --=20 2.41.0 From nobody Sat May 18 13:16:20 2024 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=1693396798; cv=none; d=zohomail.com; s=zohoarc; b=LDVv+2j3n4EUKj+BF5vnkhsoMkCuwQxKitKh3YlbQ2O36pDHuPxvoxDqtkU8D7Tow7fubM+iiZr1AVOsg0QLRlkvILBjDROUtSeRdRRZqlND/HM0ahKCPcJx3mwv3YejvGi3SgULD/gxDw3yGCpEOnYbR2/W+WqkztCRaBhUNBk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693396798; 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=TWQwX5+rddxbMxdMaa1pbLG02F+2SLr2BzZ3KASsZGM=; b=ULMgW5/1FswGPDHP0nEggrk7Kxn06764vECMxdFJ2+Fnbq4Phvv3uwEO2t7OmnKMcCysAlm9avZ/EulVZtVgxG1oCpH5rxVTdZa/NrZEVApAtt/reXmyRzEfYRShBQXxyD4a+VmEn+efK7iWAtN12FfJxI7giD3mp0eYzjZtKRI= 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 1693396798869347.4824090761276; Wed, 30 Aug 2023 04:59:58 -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-594-bZBJw1TRNtehL1WlZikaLw-1; Wed, 30 Aug 2023 07:59:55 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 695B7803E2E; Wed, 30 Aug 2023 11:59:52 +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 5656B2166B28; Wed, 30 Aug 2023 11:59:52 +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 A9A0619451E2; Wed, 30 Aug 2023 11:59:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0379819451D1 for ; Wed, 30 Aug 2023 11:59:30 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id E8812C15BB8; Wed, 30 Aug 2023 11:59:29 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id D8EB0C15BAE for ; Wed, 30 Aug 2023 11:59:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693396797; 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=TWQwX5+rddxbMxdMaa1pbLG02F+2SLr2BzZ3KASsZGM=; b=BlJf1ODf7oAprV/w8wN8UEvuQOgB+vPeS+/ajURHQ7TgqvjmIhlAKMpQFdv1EU6AzCvvt2 MQw0nH7peJFD8KrdsNoYKn65rBq2IsAyOj2xyBLuP3LYuHcqt4YD/1JN46dd1mmj7N/sJX ApW9A28s08myl6KGsWMPUOguf/ZN7jo= X-MC-Unique: bZBJw1TRNtehL1WlZikaLw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 6/8] nss: aiforaf: Drop unused buffer 'port' Date: Wed, 30 Aug 2023 13:59:20 +0200 Message-ID: <543032e8d54b3eefa60e1c04ca6d4ddce560c417.1693396633.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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.6 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: 1693396799212100001 Content-Type: text/plain; charset="utf-8" The 'port' buffer is passed to 'getnameinfo' which is supposed to fill it but it's not actually later used. Drop the buffer as 'getnameinfo' allows NULL arguments if they are not needed. Signed-off-by: Peter Krempa Reviewed-by: Kristina Hanicova --- tools/nss/libvirt_nss.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/nss/libvirt_nss.c b/tools/nss/libvirt_nss.c index faa44e78df..37720bf4ae 100644 --- a/tools/nss/libvirt_nss.c +++ b/tools/nss/libvirt_nss.c @@ -493,7 +493,6 @@ aiforaf(const char *name, socklen_t salen; void *address =3D *addrList; char host[NI_MAXHOST]; - char port[NI_MAXSERV]; if (resolved.h_addrtype =3D=3D AF_INET) { sa.sin.sin_family =3D AF_INET; @@ -511,7 +510,7 @@ aiforaf(const char *name, if ((err =3D getnameinfo(&sa.sa, salen, host, sizeof(host), - port, sizeof(port), + NULL, 0, NI_NUMERICHOST | NI_NUMERICSERV)) !=3D 0) { ERROR("Cannot convert socket address to string: %s", gai_strerror(err)); --=20 2.41.0 From nobody Sat May 18 13:16:20 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=1693396807; cv=none; d=zohomail.com; s=zohoarc; b=Yqc6jx3WXrocYaX7Y0/AliV7uCdQua0NtbYMVeORGhqkQ1jBFnBc8EPVwFiCvY73XxjzF1uxmQ4h8kVuJNfo7r/011PDaTqb3eYKZF7I2FfMrI1bS1Ry3qSUjJcN+sWXFKd+cOE659wbqteNPnIksQ9dFpq+DW8ebYiSkvrx3/g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693396807; 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=3toH/O0hAXkD6M01VVAzlN/7DoPI+ykVlOaHlvkF3AY=; b=m5dzV4bVyftk/zczoJzJMQF1oKRUZs6wkVMG7OOjVFHivOCsUugYLIYSSKvS2lG8OFIJc5kkxL7SIHD5ImR4jp4dnWEMMF00iPFM5WtK3tQ+TcOUhbtQjmkOP7USt+KPzw837JpolGVbFndhOxDlWJYPkJOKqlH6dAgcrg2emhM= 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 1693396807772687.1512008409971; Wed, 30 Aug 2023 05:00:07 -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-345-vsBHIup8PZS54ZHY5htrgg-1; Wed, 30 Aug 2023 08:00:04 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C465E101A5B9; Wed, 30 Aug 2023 12:00:01 +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 B03FC140E919; Wed, 30 Aug 2023 12:00:01 +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 E233B19451F1; Wed, 30 Aug 2023 11:59:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 275FD1946A43 for ; Wed, 30 Aug 2023 11:59:32 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 1B5B7C15BB8; Wed, 30 Aug 2023 11:59:32 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1D69CC15BAE for ; Wed, 30 Aug 2023 11:59:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693396806; 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=3toH/O0hAXkD6M01VVAzlN/7DoPI+ykVlOaHlvkF3AY=; b=Dpwr53EbKTWkjijqApbtj6d5h3Wf+dMU6zibn/WogBwF7TGX49/dRqM5MuWJfbA3xPKoEy ZTOgNW3rhR2Ekh6fwino/ntDa58CJm3SFcGMIcPBXGjeqTG7RZkZDZiP5ODAdbCp8kxuRD AVeTinQKFCqWFtyk8cIFxrmflpaBNU8= X-MC-Unique: vsBHIup8PZS54ZHY5htrgg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 7/8] nss: aiforaf: Decrease stack size by scoping off large buffers. Date: Wed, 30 Aug 2023 13:59:21 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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.7 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: 1693396809316100003 Content-Type: text/plain; charset="utf-8" The 'buf', 'sa' and 'hints' stack allocated helper variables are never used together. Decrease the stack memory usage by scoping them off into do-while blocks. In this instance we do not want to use dynamic allocation as this is the NSS module. Signed-off-by: Peter Krempa Reviewed-by: Kristina Hanicova --- tools/nss/libvirt_nss.c | 97 +++++++++++++++++++++++------------------ 1 file changed, 54 insertions(+), 43 deletions(-) diff --git a/tools/nss/libvirt_nss.c b/tools/nss/libvirt_nss.c index 37720bf4ae..dff3c034bf 100644 --- a/tools/nss/libvirt_nss.c +++ b/tools/nss/libvirt_nss.c @@ -470,61 +470,72 @@ aiforaf(const char *name, struct addrinfo **aip) { struct hostent resolved; - char buf[1024] =3D { 0 }; int err; - int herr; - struct addrinfo hints; - struct addrinfo *res0; - struct addrinfo *res; char **addrList; - if (NSS_NAME(gethostbyname2)(name, af, &resolved, - buf, sizeof(buf), - &err, &herr) !=3D NS_SUCCESS) - return; + /* Note: The do-while blocks in this function are used to scope off la= rge + * stack allocated buffers, which are not needed at the same time */ + do { + char buf[1024] =3D { 0 }; + int herr; + + if (NSS_NAME(gethostbyname2)(name, af, &resolved, + buf, sizeof(buf), + &err, &herr) !=3D NS_SUCCESS) + return; + } while (false); addrList =3D resolved.h_addr_list; while (*addrList) { - union { - struct sockaddr sa; - struct sockaddr_in sin; - struct sockaddr_in6 sin6; - } sa =3D { 0 }; - socklen_t salen; void *address =3D *addrList; char host[NI_MAXHOST]; + struct addrinfo *res0; + struct addrinfo *res; + + do { + union { + struct sockaddr sa; + struct sockaddr_in sin; + struct sockaddr_in6 sin6; + } sa =3D { 0 }; + socklen_t salen; + + if (resolved.h_addrtype =3D=3D AF_INET) { + sa.sin.sin_family =3D AF_INET; + memcpy(&sa.sin.sin_addr.s_addr, + address, + FAMILY_ADDRESS_SIZE(AF_INET)); + salen =3D sizeof(sa.sin); + } else { + sa.sin6.sin6_family =3D AF_INET6; + memcpy(&sa.sin6.sin6_addr.s6_addr, + address, + FAMILY_ADDRESS_SIZE(AF_INET6)); + salen =3D sizeof(sa.sin6); + } - if (resolved.h_addrtype =3D=3D AF_INET) { - sa.sin.sin_family =3D AF_INET; - memcpy(&sa.sin.sin_addr.s_addr, - address, - FAMILY_ADDRESS_SIZE(AF_INET)); - salen =3D sizeof(sa.sin); - } else { - sa.sin6.sin6_family =3D AF_INET6; - memcpy(&sa.sin6.sin6_addr.s6_addr, - address, - FAMILY_ADDRESS_SIZE(AF_INET6)); - salen =3D sizeof(sa.sin6); - } + if ((err =3D getnameinfo(&sa.sa, salen, + host, sizeof(host), + NULL, 0, + NI_NUMERICHOST | NI_NUMERICSERV)) !=3D = 0) { + ERROR("Cannot convert socket address to string: %s", + gai_strerror(err)); + continue; + } + } while (false); - if ((err =3D getnameinfo(&sa.sa, salen, - host, sizeof(host), - NULL, 0, - NI_NUMERICHOST | NI_NUMERICSERV)) !=3D 0) { - ERROR("Cannot convert socket address to string: %s", - gai_strerror(err)); - continue; - } + do { + struct addrinfo hints; - hints =3D *pai; - hints.ai_flags =3D AI_NUMERICHOST; - hints.ai_family =3D af; + hints =3D *pai; + hints.ai_flags =3D AI_NUMERICHOST; + hints.ai_family =3D af; - if (getaddrinfo(host, NULL, &hints, &res0)) { - addrList++; - continue; - } + if (getaddrinfo(host, NULL, &hints, &res0)) { + addrList++; + continue; + } + } while (false); for (res =3D res0; res; res =3D res->ai_next) res->ai_flags =3D pai->ai_flags; --=20 2.41.0 From nobody Sat May 18 13:16:20 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=1693396805; cv=none; d=zohomail.com; s=zohoarc; b=bDKdzqxMykRzmeUZylEvFjqQI3FUi27sh8oyYV3CB5ZWYTskcvJ8DmEkJqrjO1kdndzfsZ7p6LK8UcAFoA9puIf/kuek1mdRTJujDVTRmtmuLdzC2Q4vqS7Xw4ie0Eypa3eydenGiSvtuwt3R62LQjS33KJ40fzxVuT0+Z7xVJw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693396805; 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=b/fT2SOTWlo102EUijeHbaY1V4FwD9nzjufW8xebfq0=; b=GxdEcu/FslG8hdAN9iVChE2rK8jNVFz3OYTEfPMIPCNfM9JlVXmQ3WH4pL9/TCR/ebA/rL7VsKPGKIwjLvoPyxNt1IvnhY5kPk1WGgF8J/aU7OAuqmHg9nUjqFXtJNX9abFC0irunNOuQzFru0WUWrIZzimJ+Ns2L599KK9Q4Nk= 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 1693396805115835.967755523853; Wed, 30 Aug 2023 05:00:05 -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-389-k7b70k0FPwmeZjVzPJK2kg-1; Wed, 30 Aug 2023 08:00:01 -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 05CEF85D063; Wed, 30 Aug 2023 11:59:59 +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 E888CC15BAE; Wed, 30 Aug 2023 11:59:58 +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 1EFDA19451FE; Wed, 30 Aug 2023 11:59:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2B7C21946A43 for ; Wed, 30 Aug 2023 11:59:33 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 0DF09C15BB8; Wed, 30 Aug 2023 11:59:33 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C518C15BAE for ; Wed, 30 Aug 2023 11:59:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693396804; 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=b/fT2SOTWlo102EUijeHbaY1V4FwD9nzjufW8xebfq0=; b=W+BNqHXlCZ27HdVpq9wqI3PgFi3MSQ+z/J0wCWGl975yYLrSmjFj+b7uDtw4evIJ3Fd7Ca J0ZS+QRVv1c6+ojf9wIGdkDDhZvn/78UHWhcK4x5qW8IFMUtiPxRIq2/f6YJ6rpoIO2atq A6KgiTCkdomyWcphlr8FUFJjvO2Fk8M= X-MC-Unique: k7b70k0FPwmeZjVzPJK2kg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 8/8] build: Decrease maximum stack frame size to 2048 Date: Wed, 30 Aug 2023 13:59:22 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693396807459100001 Content-Type: text/plain; charset="utf-8" After recent cleanups we can now restrict the maximum stack frame size to 2k. Signed-off-by: Peter Krempa Reviewed-by: Kristina Hanicova --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 965ada483b..e45f3e2c39 100644 --- a/meson.build +++ b/meson.build @@ -248,7 +248,7 @@ alloc_max =3D run_command( ) # sanitizer instrumentation may enlarge stack frames -stack_frame_size =3D get_option('b_sanitize') =3D=3D 'none' ? 4096 : 32768 +stack_frame_size =3D get_option('b_sanitize') =3D=3D 'none' ? 2048 : 32768 # array_bounds=3D2 check triggers false positive on some GCC # versions when using sanitizers. Seen on Fedora 34 with --=20 2.41.0