[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v2] x86/domctl: remove impossible condition in XEN_DOMCTL_getpageframeinfo3



The value of num is always the same as domctl->u.getpageframeinfo3.num,
it was assigned just a few lines before. Avoid truncation by making
num the same size as i, which is the only place where num is used.

Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
---
 xen/arch/x86/domctl.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index daf733de4f..5d979e3a0f 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -415,14 +415,13 @@ long arch_do_domctl(
 
     case XEN_DOMCTL_getpageframeinfo3:
     {
-        unsigned int num = domctl->u.getpageframeinfo3.num;
+        unsigned long num = domctl->u.getpageframeinfo3.num;
         unsigned int width = has_32bit_shinfo(currd) ? 4 : 8;
 
         /* Games to allow this code block to handle a compat guest. */
         void __user *guest_handle = domctl->u.getpageframeinfo3.array.p;
 
-        if ( unlikely(num > XEN_GETPAGEFRAMEINFO3_MAX_SIZE) ||
-             unlikely(num != domctl->u.getpageframeinfo3.num) )
+        if ( unlikely(num > XEN_GETPAGEFRAMEINFO3_MAX_SIZE) )
         {
             ret = -E2BIG;
             break;

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.