From nobody Mon Feb 9 21:38:19 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@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 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1620398674; cv=none; d=zohomail.com; s=zohoarc; b=i28YmyW96gWVCarafq8pVgYfLH9kgwJUNbGP/Zznvd+1Ie1lAU2FHJ0iDbpuD3XSzZvmJd4SHhtTDTY5nysrzQRnW630DBttCxhPMJ5BUuNeJ5npbm5wsH1A0cN3VHsRf2psHTAs0GddY6CveTcgkJQaGq6hqsKznbnxoM/+zKU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620398674; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=C+MYJWIsLohbCHlMSEIGcZQyDaEDuU9Kl0ow5213YNc=; b=dAIAflB/Ca/fiixo5I5ICNWXAocagfdGSydejrUKf1pOau5hucV2HwV/6I6SfR9EFSbRy6kV6Ph+IMpFeVIOw7RjwRCfsOALt3Ajno6YIAeMpR/2f0oSQt80oLwfD7XSVEcn2suzV3wFVsEgqIVQkdPfOPLShYr5T9BtwpaQUKg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1620398674151243.33781101969453; Fri, 7 May 2021 07:44:34 -0700 (PDT) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-153-1DQMP748NHyBokZ4Pu5rng-1; Fri, 07 May 2021 10:44:31 -0400 Received: by mail-wr1-f70.google.com with SMTP id 4-20020adf80040000b029010cab735fdeso3680750wrk.14 for ; Fri, 07 May 2021 07:44:31 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (astrasbourg-652-1-219-60.w90-40.abo.wanadoo.fr. [90.40.114.60]) by smtp.gmail.com with ESMTPSA id r13sm8833726wrn.2.2021.05.07.07.44.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 May 2021 07:44:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620398672; 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=C+MYJWIsLohbCHlMSEIGcZQyDaEDuU9Kl0ow5213YNc=; b=NfUb/IMMZ15ZlLYpuzJQaGCRBYaJFx5IA74sPv2Fygnr0h/ipFqG2/osM+6EnDj16GbE6F 7PXBTQ0s9ZWDLAWla3OzRJo1dokMY5OlLj/VDPfepjuoUsTdZ9BdJiAdPdLBVjzPvmVvUW 26iVOIvToYAs2u/J+lxo57sSOgE1cuQ= X-MC-Unique: 1DQMP748NHyBokZ4Pu5rng-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=C+MYJWIsLohbCHlMSEIGcZQyDaEDuU9Kl0ow5213YNc=; b=PgvTFsjVyhgvxpmcIphWWt599ZE46FnwETjdnmQ5tZjEIuXTDG8xp0FDKJ4nxD0dxO EAadTnRGNprIcRAecJD74bpfXy0Cu2qEL8vfeBFX4zQ82JxB6qr99zafv3GqwnEb5/7n 2O2XuURlH5SvLkvXgs37m+gvhAHiSnjuCoCg9p8v1qxe1Re2ZCwHyIsfmiLqyqF8SdS4 hL8pnZStpF8pkmmX6zjS4kG2M74K9HH0qBPYsv8TQUlS7TSRuWfAX3fJvZvTd55eU6gV xapbgc92CC87lh/Sjf2mONoHjvFj8j67ZB2QSUsqccQHA+kDJ3wh7KkIK5hGWacE8RS6 nnjw== X-Gm-Message-State: AOAM532EtUxJA9fq7ik5WVNbzPAa0McuH6qTk3ukeJIiAhXPP8T/RtTO sELHIkpTWtjiP6FEduVYfZUgqY30hzdE8IP6GPnqMzODGaccMAlsmKg08iT9kz/d94QQp1w3XgM YTl8cU5BLETPZvw== X-Received: by 2002:adf:f80f:: with SMTP id s15mr12876023wrp.341.1620398670260; Fri, 07 May 2021 07:44:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyV3LXdgDeT9W3nPy2PYFEyT0xnL/c2fIbnfgtcygElbhUWgwrD2nI+U4GtCxZ9QE5ZsaU17g== X-Received: by 2002:adf:f80f:: with SMTP id s15mr12876009wrp.341.1620398670157; Fri, 07 May 2021 07:44:30 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Laurent Vivier , Paolo Bonzini , qemu-ppc@nongnu.org, Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Gerd Hoffmann , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Greg Kurz , David Gibson , kvm@vger.kernel.org (open list:Overall KVM CPUs) Subject: [PATCH v3 15/17] target/ppc/kvm: Replace alloca() by g_malloc() Date: Fri, 7 May 2021 16:43:13 +0200 Message-Id: <20210507144315.1994337-16-philmd@redhat.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210507144315.1994337-1-philmd@redhat.com> References: <20210507144315.1994337-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com 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) The ALLOCA(3) man-page mentions its "use is discouraged". Use autofree heap allocation instead, replacing it by a g_malloc call. Reviewed-by: Greg Kurz Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/ppc/kvm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 104a308abb5..23c4ea377e8 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -2698,11 +2698,11 @@ int kvmppc_save_htab(QEMUFile *f, int fd, size_t bu= fsize, int64_t max_ns) int kvmppc_load_htab_chunk(QEMUFile *f, int fd, uint32_t index, uint16_t n_valid, uint16_t n_invalid, Error **e= rrp) { - struct kvm_get_htab_header *buf; + g_autofree struct kvm_get_htab_header *buf =3D NULL; size_t chunksize =3D sizeof(*buf) + n_valid * HASH_PTE_SIZE_64; ssize_t rc; =20 - buf =3D alloca(chunksize); + buf =3D g_malloc(chunksize); buf->index =3D index; buf->n_valid =3D n_valid; buf->n_invalid =3D n_invalid; --=20 2.26.3