From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C583BC433B4 for ; Thu, 6 May 2021 02:18:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A42A6613BC for ; Thu, 6 May 2021 02:18:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231334AbhEFCTP (ORCPT ); Wed, 5 May 2021 22:19:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231321AbhEFCTP (ORCPT ); Wed, 5 May 2021 22:19:15 -0400 Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09BB4C061574 for ; Wed, 5 May 2021 19:18:18 -0700 (PDT) Received: by ozlabs.org (Postfix, from userid 1007) id 4FbHLJ0L7mz9sW4; Thu, 6 May 2021 12:18:16 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1620267496; bh=WYlB70z+eVZIq1j3dLlNhnhyis7gJO8sepMb+y0/sTQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VCGtcRBGWJeV11yW5ubhxiYhOD6KpXQMvdcPs3tSJqg4LGbCl9FyKk8Xk8OLtCaPO dyCO+yoVFqC//REDbVEapPLR0wlHsy5JD5dGTVQ+71xC0AC+DBSidzABjkCBakSq07 LfR1AWYQbuw6vAETyYht19C0yZKqK5JX8DPddVe4= Date: Thu, 6 May 2021 12:16:29 +1000 From: David Gibson To: Philippe =?iso-8859-1?Q?Mathieu-Daud=E9?= Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, Daniel =?iso-8859-1?Q?P=2E_Berrang=E9?= , qemu-ppc@nongnu.org, Gerd Hoffmann , =?iso-8859-1?Q?Marc-Andr=E9?= Lureau , Paolo Bonzini , Richard Henderson , Greg Kurz , "open list:Overall KVM CPUs" Subject: Re: [PATCH 21/23] target/ppc/kvm: Avoid dynamic stack allocation Message-ID: References: <20210505211047.1496765-1-philmd@redhat.com> <20210505211047.1496765-22-philmd@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="4nfXEX1oz+WC3sSD" Content-Disposition: inline In-Reply-To: <20210505211047.1496765-22-philmd@redhat.com> Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org --4nfXEX1oz+WC3sSD Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 05, 2021 at 11:10:45PM +0200, Philippe Mathieu-Daud=E9 wrote: > Use autofree heap allocation instead of variable-length > array on the stack. >=20 > Signed-off-by: Philippe Mathieu-Daud=E9 Acked-by: David Gibson > --- > target/ppc/kvm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c > index ae62daddf7d..90d0230eb86 100644 > --- a/target/ppc/kvm.c > +++ b/target/ppc/kvm.c > @@ -2660,7 +2660,7 @@ int kvmppc_get_htab_fd(bool write, uint64_t index, = Error **errp) > int kvmppc_save_htab(QEMUFile *f, int fd, size_t bufsize, int64_t max_ns) > { > int64_t starttime =3D qemu_clock_get_ns(QEMU_CLOCK_REALTIME); > - uint8_t buf[bufsize]; > + g_autofree uint8_t *buf =3D g_malloc(bufsize); > ssize_t rc; > =20 > do { --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --4nfXEX1oz+WC3sSD Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAmCTUX0ACgkQbDjKyiDZ s5J1Xg//fP1CCuNm/HXYPKD8uyQHwvtdILvGbw+HFXKQczWuXk0sjY8FFMtKSRzI wJeYsZ2GmWAolWYLsVqquprjj4ciC2jjRW17ktQTI1BfvjossxiolQUpDFvRgW8m ZLGcL9FzEKEJsN3izzKLlYtfmNt/VrPxl5+Oplp/TCyZmoGHyXDthBjss7+ShBss Bb1y8XkpFyne5dL1pounzAMIhw1o7WPGDzWBhVxTpZeFUqlkRcUCl8cahxgFMcjf YeJzjwS6on8wj32r3eoUQu8SPJDehkRI76HC/np5P6oWn15/F4Cq4hE3kQvidM1/ luCwRFY04TPHVL7BNDcnV1zyCjtJ/TvlqNbWIHIYhdpahi1uBkM2Qq91bdB1Ehg1 mJczNaXIJbqqT6/BIsbX4MXOCdSCxNCwdRHJupaqzZJGGM+GjmGkXeZmuhJHajh8 s2uAy02ZSqHn+ZBA+Q2lw18gEixs5//IjfEsJ+XE8Ju88ax/UMWr9TpfWcG1IGFu yAw7CufbuLdF2yvqCvbfeCHbpaNQ0udUpIb8ZO2URtCvFY59s7q+RAg7hsBliYVH L+iRuKLctjsxPut99eGq8dWaKLr31JmcnULc6t0Dicak5CVQIXye/vP0a9xIyqxT mR2jrBRpg+rDTdKWGX03s3XO5u9a18DnmikjtMlpqmLPPHlQq9U= =JU2c -----END PGP SIGNATURE----- --4nfXEX1oz+WC3sSD-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65DB2C433ED for ; Thu, 6 May 2021 02:19:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 07418613B5 for ; Thu, 6 May 2021 02:19:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 07418613B5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:37378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leTc3-0007rg-1x for qemu-devel@archiver.kernel.org; Wed, 05 May 2021 22:19:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33376) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leTav-0005oj-8U; Wed, 05 May 2021 22:18:30 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:55313 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leTaq-0004ca-Q3; Wed, 05 May 2021 22:18:28 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4FbHLJ0L7mz9sW4; Thu, 6 May 2021 12:18:16 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1620267496; bh=WYlB70z+eVZIq1j3dLlNhnhyis7gJO8sepMb+y0/sTQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VCGtcRBGWJeV11yW5ubhxiYhOD6KpXQMvdcPs3tSJqg4LGbCl9FyKk8Xk8OLtCaPO dyCO+yoVFqC//REDbVEapPLR0wlHsy5JD5dGTVQ+71xC0AC+DBSidzABjkCBakSq07 LfR1AWYQbuw6vAETyYht19C0yZKqK5JX8DPddVe4= Date: Thu, 6 May 2021 12:16:29 +1000 From: David Gibson To: Philippe =?iso-8859-1?Q?Mathieu-Daud=E9?= Subject: Re: [PATCH 21/23] target/ppc/kvm: Avoid dynamic stack allocation Message-ID: References: <20210505211047.1496765-1-philmd@redhat.com> <20210505211047.1496765-22-philmd@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="4nfXEX1oz+WC3sSD" Content-Disposition: inline In-Reply-To: <20210505211047.1496765-22-philmd@redhat.com> Received-SPF: pass client-ip=2401:3900:2:1::2; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel =?iso-8859-1?Q?P=2E_Berrang=E9?= , "open list:Overall KVM CPUs" , qemu-block@nongnu.org, Richard Henderson , qemu-devel@nongnu.org, Greg Kurz , qemu-ppc@nongnu.org, Gerd Hoffmann , Paolo Bonzini , =?iso-8859-1?Q?Marc-Andr=E9?= Lureau Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --4nfXEX1oz+WC3sSD Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 05, 2021 at 11:10:45PM +0200, Philippe Mathieu-Daud=E9 wrote: > Use autofree heap allocation instead of variable-length > array on the stack. >=20 > Signed-off-by: Philippe Mathieu-Daud=E9 Acked-by: David Gibson > --- > target/ppc/kvm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c > index ae62daddf7d..90d0230eb86 100644 > --- a/target/ppc/kvm.c > +++ b/target/ppc/kvm.c > @@ -2660,7 +2660,7 @@ int kvmppc_get_htab_fd(bool write, uint64_t index, = Error **errp) > int kvmppc_save_htab(QEMUFile *f, int fd, size_t bufsize, int64_t max_ns) > { > int64_t starttime =3D qemu_clock_get_ns(QEMU_CLOCK_REALTIME); > - uint8_t buf[bufsize]; > + g_autofree uint8_t *buf =3D g_malloc(bufsize); > ssize_t rc; > =20 > do { --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --4nfXEX1oz+WC3sSD Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAmCTUX0ACgkQbDjKyiDZ s5J1Xg//fP1CCuNm/HXYPKD8uyQHwvtdILvGbw+HFXKQczWuXk0sjY8FFMtKSRzI wJeYsZ2GmWAolWYLsVqquprjj4ciC2jjRW17ktQTI1BfvjossxiolQUpDFvRgW8m ZLGcL9FzEKEJsN3izzKLlYtfmNt/VrPxl5+Oplp/TCyZmoGHyXDthBjss7+ShBss Bb1y8XkpFyne5dL1pounzAMIhw1o7WPGDzWBhVxTpZeFUqlkRcUCl8cahxgFMcjf YeJzjwS6on8wj32r3eoUQu8SPJDehkRI76HC/np5P6oWn15/F4Cq4hE3kQvidM1/ luCwRFY04TPHVL7BNDcnV1zyCjtJ/TvlqNbWIHIYhdpahi1uBkM2Qq91bdB1Ehg1 mJczNaXIJbqqT6/BIsbX4MXOCdSCxNCwdRHJupaqzZJGGM+GjmGkXeZmuhJHajh8 s2uAy02ZSqHn+ZBA+Q2lw18gEixs5//IjfEsJ+XE8Ju88ax/UMWr9TpfWcG1IGFu yAw7CufbuLdF2yvqCvbfeCHbpaNQ0udUpIb8ZO2URtCvFY59s7q+RAg7hsBliYVH L+iRuKLctjsxPut99eGq8dWaKLr31JmcnULc6t0Dicak5CVQIXye/vP0a9xIyqxT mR2jrBRpg+rDTdKWGX03s3XO5u9a18DnmikjtMlpqmLPPHlQq9U= =JU2c -----END PGP SIGNATURE----- --4nfXEX1oz+WC3sSD--