From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33434) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgS8c-0000FR-2Y for qemu-devel@nongnu.org; Fri, 10 Apr 2015 02:09:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YgS8Y-0006a9-QB for qemu-devel@nongnu.org; Fri, 10 Apr 2015 02:09:57 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:60714) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgS8Y-0006Yp-7y for qemu-devel@nongnu.org; Fri, 10 Apr 2015 02:09:54 -0400 Message-ID: <552767E8.2040105@huawei.com> Date: Fri, 10 Apr 2015 14:04:24 +0800 From: Shannon Zhao MIME-Version: 1.0 References: <1428055432-12120-1-git-send-email-zhaoshenglong@huawei.com> <1428055432-12120-13-git-send-email-zhaoshenglong@huawei.com> <87y4m1z49y.fsf@linaro.org> In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit 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: Peter Maydell , =?UTF-8?B?QWxleCBCZW5uw6ll?= Cc: hangaohuai@huawei.com, "Michael S. Tsirkin" , Alexander Spyridakis , Mark Salter , Claudio Fontana , QEMU Developers , "Huangpeng (Peter)" , Hanjun Guo , Igor Mammedov , Paolo Bonzini , Laszlo Ersek , Christoffer Dall , Shannon Zhao On 2015/4/10 0:00, Peter Maydell wrote: > On 9 April 2015 at 16:54, Alex Bennée wrote: >> > >> > Shannon Zhao writes: >> > >>> >> From: Shannon Zhao >>> >> +build_mcfg(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info) >>> >> +{ >>> >> + AcpiTableMcfg *mcfg; >>> >> + acpi_pcie_info *info = guest_info->pcie_info; >>> >> + int len = 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? The 1 means here only a single allocation for use. -- Thanks, Shannon