From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754010AbbINM6K (ORCPT ); Mon, 14 Sep 2015 08:58:10 -0400 Received: from smtp.citrix.com ([66.165.176.89]:20295 "EHLO SMTP.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753672AbbINM6H (ORCPT ); Mon, 14 Sep 2015 08:58:07 -0400 X-IronPort-AV: E=Sophos;i="5.17,528,1437436800"; d="scan'208";a="299838891" Message-ID: <55F6C415.4000306@citrix.com> Date: Mon, 14 Sep 2015 13:56:53 +0100 From: Julien Grall User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.8.0 MIME-Version: 1.0 To: Juergen Gross , , , , , Subject: Re: [Xen-devel] [PATCH] xen: use correct type for HYPERVISOR_memory_op() References: <1441371033-22717-1-git-send-email-jgross@suse.com> In-Reply-To: <1441371033-22717-1-git-send-email-jgross@suse.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-DLP: MIA1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Juergen, On 04/09/15 13:50, Juergen Gross wrote: > HYPERVISOR_memory_op() is defined to return an "int" value. This is > wrong, as the Xen hypervisor will return "long". > > The sub-function XENMEM_maximum_reservation returns the maximum > number of pages for the current domain. An int will overflow for a > domain configured with 8TB of memory or more. > > Correct this by using the correct type. Can you also fix the ARM version of the prototype (arm/include/asm/xen/hypercall.h) in order to keep them in sync? Regards, > Signed-off-by: Juergen Gross > --- > arch/x86/include/asm/xen/hypercall.h | 4 ++-- > arch/x86/xen/setup.c | 2 +- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h > index ca08a27..b7a735f 100644 > --- a/arch/x86/include/asm/xen/hypercall.h > +++ b/arch/x86/include/asm/xen/hypercall.h > @@ -336,10 +336,10 @@ HYPERVISOR_update_descriptor(u64 ma, u64 desc) > return _hypercall4(int, update_descriptor, ma, ma>>32, desc, desc>>32); > } > > -static inline int > +static inline long > HYPERVISOR_memory_op(unsigned int cmd, void *arg) > { > - return _hypercall2(int, memory_op, cmd, arg); > + return _hypercall2(long, memory_op, cmd, arg); > } > > static inline int > diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c > index f5ef674..4ebfcec 100644 > --- a/arch/x86/xen/setup.c > +++ b/arch/x86/xen/setup.c > @@ -548,7 +548,7 @@ static unsigned long __init xen_get_max_pages(void) > { > unsigned long max_pages, limit; > domid_t domid = DOMID_SELF; > - int ret; > + long ret; > > limit = xen_get_pages_limit(); > max_pages = limit; > -- Julien Grall From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [Xen-devel] [PATCH] xen: use correct type for HYPERVISOR_memory_op() Date: Mon, 14 Sep 2015 13:56:53 +0100 Message-ID: <55F6C415.4000306@citrix.com> References: <1441371033-22717-1-git-send-email-jgross@suse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1441371033-22717-1-git-send-email-jgross@suse.com> Sender: linux-kernel-owner@vger.kernel.org To: Juergen Gross , linux-kernel@vger.kernel.org, xen-devel@lists.xensource.com, konrad.wilk@oracle.com, david.vrabel@citrix.com, boris.ostrovsky@oracle.com List-Id: xen-devel@lists.xenproject.org Hi Juergen, On 04/09/15 13:50, Juergen Gross wrote: > HYPERVISOR_memory_op() is defined to return an "int" value. This is > wrong, as the Xen hypervisor will return "long". > > The sub-function XENMEM_maximum_reservation returns the maximum > number of pages for the current domain. An int will overflow for a > domain configured with 8TB of memory or more. > > Correct this by using the correct type. Can you also fix the ARM version of the prototype (arm/include/asm/xen/hypercall.h) in order to keep them in sync? Regards, > Signed-off-by: Juergen Gross > --- > arch/x86/include/asm/xen/hypercall.h | 4 ++-- > arch/x86/xen/setup.c | 2 +- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h > index ca08a27..b7a735f 100644 > --- a/arch/x86/include/asm/xen/hypercall.h > +++ b/arch/x86/include/asm/xen/hypercall.h > @@ -336,10 +336,10 @@ HYPERVISOR_update_descriptor(u64 ma, u64 desc) > return _hypercall4(int, update_descriptor, ma, ma>>32, desc, desc>>32); > } > > -static inline int > +static inline long > HYPERVISOR_memory_op(unsigned int cmd, void *arg) > { > - return _hypercall2(int, memory_op, cmd, arg); > + return _hypercall2(long, memory_op, cmd, arg); > } > > static inline int > diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c > index f5ef674..4ebfcec 100644 > --- a/arch/x86/xen/setup.c > +++ b/arch/x86/xen/setup.c > @@ -548,7 +548,7 @@ static unsigned long __init xen_get_max_pages(void) > { > unsigned long max_pages, limit; > domid_t domid = DOMID_SELF; > - int ret; > + long ret; > > limit = xen_get_pages_limit(); > max_pages = limit; > -- Julien Grall