* [Patch V2] xen: use correct type for HYPERVISOR_memory_op()
@ 2015-09-14 13:13 Juergen Gross
2015-09-14 14:06 ` Boris Ostrovsky
2015-09-14 14:06 ` Boris Ostrovsky
0 siblings, 2 replies; 4+ messages in thread
From: Juergen Gross @ 2015-09-14 13:13 UTC (permalink / raw)
To: linux-kernel, xen-devel, konrad.wilk, david.vrabel,
boris.ostrovsky, julien.grall
Cc: Juergen Gross
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.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
V2: change arm header as well to keep it in sync with x86
(requested by Julien Grall)
---
arch/arm/include/asm/xen/hypercall.h | 2 +-
arch/x86/include/asm/xen/hypercall.h | 4 ++--
arch/x86/xen/setup.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/arm/include/asm/xen/hypercall.h b/arch/arm/include/asm/xen/hypercall.h
index 712b50e..47f0d81 100644
--- a/arch/arm/include/asm/xen/hypercall.h
+++ b/arch/arm/include/asm/xen/hypercall.h
@@ -45,7 +45,7 @@ int HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count);
int HYPERVISOR_sched_op(int cmd, void *arg);
int HYPERVISOR_event_channel_op(int cmd, void *arg);
unsigned long HYPERVISOR_hvm_op(int op, void *arg);
-int HYPERVISOR_memory_op(unsigned int cmd, void *arg);
+long HYPERVISOR_memory_op(unsigned int cmd, void *arg);
int HYPERVISOR_physdev_op(int cmd, void *arg);
int HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args);
int HYPERVISOR_tmem_op(void *arg);
diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h
index 83aea80..4c20dd3 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;
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Patch V2] xen: use correct type for HYPERVISOR_memory_op()
@ 2015-09-14 13:13 Juergen Gross
0 siblings, 0 replies; 4+ messages in thread
From: Juergen Gross @ 2015-09-14 13:13 UTC (permalink / raw)
To: linux-kernel, xen-devel, konrad.wilk, david.vrabel,
boris.ostrovsky, julien.grall
Cc: Juergen Gross
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.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
V2: change arm header as well to keep it in sync with x86
(requested by Julien Grall)
---
arch/arm/include/asm/xen/hypercall.h | 2 +-
arch/x86/include/asm/xen/hypercall.h | 4 ++--
arch/x86/xen/setup.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/arm/include/asm/xen/hypercall.h b/arch/arm/include/asm/xen/hypercall.h
index 712b50e..47f0d81 100644
--- a/arch/arm/include/asm/xen/hypercall.h
+++ b/arch/arm/include/asm/xen/hypercall.h
@@ -45,7 +45,7 @@ int HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count);
int HYPERVISOR_sched_op(int cmd, void *arg);
int HYPERVISOR_event_channel_op(int cmd, void *arg);
unsigned long HYPERVISOR_hvm_op(int op, void *arg);
-int HYPERVISOR_memory_op(unsigned int cmd, void *arg);
+long HYPERVISOR_memory_op(unsigned int cmd, void *arg);
int HYPERVISOR_physdev_op(int cmd, void *arg);
int HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args);
int HYPERVISOR_tmem_op(void *arg);
diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h
index 83aea80..4c20dd3 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;
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Patch V2] xen: use correct type for HYPERVISOR_memory_op()
2015-09-14 13:13 [Patch V2] xen: use correct type for HYPERVISOR_memory_op() Juergen Gross
2015-09-14 14:06 ` Boris Ostrovsky
@ 2015-09-14 14:06 ` Boris Ostrovsky
1 sibling, 0 replies; 4+ messages in thread
From: Boris Ostrovsky @ 2015-09-14 14:06 UTC (permalink / raw)
To: Juergen Gross, linux-kernel, xen-devel, konrad.wilk, david.vrabel,
julien.grall
On 09/14/2015 09:13 AM, 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.
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
> V2: change arm header as well to keep it in sync with x86
> (requested by Julien Grall)
> ---
> arch/arm/include/asm/xen/hypercall.h | 2 +-
> arch/x86/include/asm/xen/hypercall.h | 4 ++--
> arch/x86/xen/setup.c | 2 +-
> 3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/include/asm/xen/hypercall.h b/arch/arm/include/asm/xen/hypercall.h
> index 712b50e..47f0d81 100644
> --- a/arch/arm/include/asm/xen/hypercall.h
> +++ b/arch/arm/include/asm/xen/hypercall.h
> @@ -45,7 +45,7 @@ int HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count);
> int HYPERVISOR_sched_op(int cmd, void *arg);
> int HYPERVISOR_event_channel_op(int cmd, void *arg);
> unsigned long HYPERVISOR_hvm_op(int op, void *arg);
> -int HYPERVISOR_memory_op(unsigned int cmd, void *arg);
> +long HYPERVISOR_memory_op(unsigned int cmd, void *arg);
> int HYPERVISOR_physdev_op(int cmd, void *arg);
> int HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args);
> int HYPERVISOR_tmem_op(void *arg);
> diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h
> index 83aea80..4c20dd3 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;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch V2] xen: use correct type for HYPERVISOR_memory_op()
2015-09-14 13:13 [Patch V2] xen: use correct type for HYPERVISOR_memory_op() Juergen Gross
@ 2015-09-14 14:06 ` Boris Ostrovsky
2015-09-14 14:06 ` Boris Ostrovsky
1 sibling, 0 replies; 4+ messages in thread
From: Boris Ostrovsky @ 2015-09-14 14:06 UTC (permalink / raw)
To: Juergen Gross, linux-kernel, xen-devel, konrad.wilk, david.vrabel,
julien.grall
On 09/14/2015 09:13 AM, 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.
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
> V2: change arm header as well to keep it in sync with x86
> (requested by Julien Grall)
> ---
> arch/arm/include/asm/xen/hypercall.h | 2 +-
> arch/x86/include/asm/xen/hypercall.h | 4 ++--
> arch/x86/xen/setup.c | 2 +-
> 3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/include/asm/xen/hypercall.h b/arch/arm/include/asm/xen/hypercall.h
> index 712b50e..47f0d81 100644
> --- a/arch/arm/include/asm/xen/hypercall.h
> +++ b/arch/arm/include/asm/xen/hypercall.h
> @@ -45,7 +45,7 @@ int HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count);
> int HYPERVISOR_sched_op(int cmd, void *arg);
> int HYPERVISOR_event_channel_op(int cmd, void *arg);
> unsigned long HYPERVISOR_hvm_op(int op, void *arg);
> -int HYPERVISOR_memory_op(unsigned int cmd, void *arg);
> +long HYPERVISOR_memory_op(unsigned int cmd, void *arg);
> int HYPERVISOR_physdev_op(int cmd, void *arg);
> int HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args);
> int HYPERVISOR_tmem_op(void *arg);
> diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h
> index 83aea80..4c20dd3 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;
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-09-14 14:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-14 13:13 [Patch V2] xen: use correct type for HYPERVISOR_memory_op() Juergen Gross
2015-09-14 14:06 ` Boris Ostrovsky
2015-09-14 14:06 ` Boris Ostrovsky
-- strict thread matches above, loose matches on Subject: below --
2015-09-14 13:13 Juergen Gross
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.