From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58087) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgEtC-0000at-NV for qemu-devel@nongnu.org; Thu, 09 Apr 2015 12:01:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YgEt8-0004i7-F5 for qemu-devel@nongnu.org; Thu, 09 Apr 2015 12:01:10 -0400 Received: from mail-ie0-f175.google.com ([209.85.223.175]:32873) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgEt8-0004i2-AM for qemu-devel@nongnu.org; Thu, 09 Apr 2015 12:01:06 -0400 Received: by iebmp1 with SMTP id mp1so104573997ieb.0 for ; Thu, 09 Apr 2015 09:01:05 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <87y4m1z49y.fsf@linaro.org> References: <1428055432-12120-1-git-send-email-zhaoshenglong@huawei.com> <1428055432-12120-13-git-send-email-zhaoshenglong@huawei.com> <87y4m1z49y.fsf@linaro.org> From: Peter Maydell Date: Thu, 9 Apr 2015 17:00:45 +0100 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v4 12/20] hw/arm/virt-acpi-build: Add PCIe info and generate MCFG table List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?QWxleCBCZW5uw6ll?= Cc: Mark Salter , hangaohuai@huawei.com, Igor Mammedov , Alexander Spyridakis , "Michael S. Tsirkin" , Claudio Fontana , QEMU Developers , "Huangpeng (Peter)" , Hanjun Guo , Shannon Zhao , Paolo Bonzini , Laszlo Ersek , Christoffer Dall , Shannon Zhao On 9 April 2015 at 16:54, Alex Benn=C3=A9e wrote: > > Shannon Zhao writes: > >> From: Shannon Zhao >> +build_mcfg(GArray *table_data, GArray *linker, VirtGuestInfo *guest_inf= o) >> +{ >> + AcpiTableMcfg *mcfg; >> + acpi_pcie_info *info =3D guest_info->pcie_info; >> + int len =3D sizeof(*mcfg) + 1 * sizeof(mcfg->allocation[0]); > > Explicit bracketing around the maths please. This doesn't seem to make much sense anyway: if the addition was intended to take precedence then we're adding 1 to a size-of-a-struct, which is a bit weird. And if the multiplication was intended to take precedence then it's doing a pointless multiply by one. Please can you check that this is actually calculating the right value? thanks -- PMM