From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: Re: [PATCH v4 08/21] arm/acpi: Parse MADT to map logical cpu to MPIDR and get cpu_possible_map Date: Mon, 25 Jan 2016 07:53:24 -0700 Message-ID: <56A644F402000078000CAB2A@prv-mh.provo.novell.com> References: <1453540813-15764-1-git-send-email-zhaoshenglong@huawei.com> <1453540813-15764-9-git-send-email-zhaoshenglong@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1453540813-15764-9-git-send-email-zhaoshenglong@huawei.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Shannon Zhao Cc: ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, peter.huangpeng@huawei.com, xen-devel@lists.xen.org, julien.grall@citrix.com, stefano.stabellini@citrix.com, shannon.zhao@linaro.org List-Id: xen-devel@lists.xenproject.org >>> On 23.01.16 at 10:20, wrote: > --- a/xen/include/xen/acpi.h > +++ b/xen/include/xen/acpi.h > @@ -39,6 +39,10 @@ > #define ACPI_MADT_GET_POLARITY(inti) ACPI_MADT_GET_(POLARITY, inti) > #define ACPI_MADT_GET_TRIGGER(inti) ACPI_MADT_GET_(TRIGGER, inti) > > +#define BAD_MADT_ENTRY(entry, end) ( \ > + (!entry) || (unsigned long)entry + sizeof(*entry) > end || \ > + ((struct acpi_subtable_header *)entry)->length < sizeof(*entry)) If you move or otherwise anyway touch existing code, please always take a critical look at it and at least fix obvious problems. Read, here: Properly parenthesize all uses of the macro's parameters. While not desirable, failing to do so may be acceptable when the scope of such definitions is very limited (as it was before you moving it), but once globally exposed it needs to be made safe. Jan