From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55174) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0fpe-0008UB-BJ for qemu-devel@nongnu.org; Tue, 07 Jan 2014 18:13:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W0fpZ-0001vX-7l for qemu-devel@nongnu.org; Tue, 07 Jan 2014 18:13:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:7754) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0fpY-0001vE-O0 for qemu-devel@nongnu.org; Tue, 07 Jan 2014 18:13:04 -0500 Message-ID: <52CC89F8.4090203@redhat.com> Date: Tue, 07 Jan 2014 16:12:56 -0700 From: Eric Blake MIME-Version: 1.0 References: <1388906864-1083-1-git-send-email-qiaonuohan@cn.fujitsu.com> <1388906864-1083-10-git-send-email-qiaonuohan@cn.fujitsu.com> <52CC81B9.1080609@redhat.com> In-Reply-To: <52CC81B9.1080609@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="gTpthcR5dmF1l7UGmbF4maB37WATr3OOE" Subject: Re: [Qemu-devel] [PATCH v6 09/11] dump: Add API to write dump pages List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laszlo Ersek , Qiao Nuohan Cc: stefanha@gmail.com, qemu-devel@nongnu.org, lcapitulino@redhat.com, anderson@redhat.com, kumagai-atsushi@mxc.nes.nec.co.jp, akong@redhat.com, afaerber@suse.de This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --gTpthcR5dmF1l7UGmbF4maB37WATr3OOE Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 01/07/2014 03:37 PM, Laszlo Ersek wrote: > comments below >=20 > On 01/05/14 08:27, Qiao Nuohan wrote: >> functions are used to write page to vmcore. vmcore is written page by = page. >> page desc is used to store the information of a page, including a page= 's size, >> offset, compression format, etc. >> >> + uint64_t pfn_start, pfn_end, pfn; >> + unsigned char buf[s->page_size]; >=20 > Whoa, a VLA! :) I believe it's *very* non-idiomatic in the qemu source.= > Please consider allocating it dynamically. (Of course others might poin= t > out that I'm wrong.) Worse, a stack allocation greater than the size of a stack frame. Any time you have a function taking more than a page size of local storage, you risk nasty behavior on some platforms (Windows in particular is notorious for giving you only a single guard page, and if you overflow the stack by more than the guard page, your program is unceremoniously terminated with no message, compared to the usual desirable behavior of getting a SIGSEGV that your program can at least react to in order to diagnose that you had a stack overflow). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --gTpthcR5dmF1l7UGmbF4maB37WATr3OOE Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJSzIn4AAoJEKeha0olJ0Nq048H/1GyApr/qvrqaY9nEvPv12Un OZTQs69LsRECbyf6Hc5010NSO9CjNHx1GQDBTiXFNOqBu3IHvl0xkPxAszFpGCe0 WkhwC05lY7AQiVULqx2kGDWyHStbH8Lj8KGYePGX1k5LsCdvI4+KP4eLaVfsy7N9 OFjBFBuELm82tgeDg0ULdG84FbqXu4lg0IoXK8ArbHWJvNZiOBFVqJGq+JIL3DoW 8YKkcYHl+QTXW6Iv8lW2frjiR1hYI63ZmF8wQ3TAijonEj9AyupWIx8ud4o1klLp RHsPBPeHWsPMFC2RwlKaIc5ztK/m+xux02jS+ZdU3433Lz4vXLf/pL3x6U3L5cI= =EkyL -----END PGP SIGNATURE----- --gTpthcR5dmF1l7UGmbF4maB37WATr3OOE--