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

[Xen-changelog] [xen-unstable] [XEN] Change microcode_update function interface inside Xen.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID 609b10b17bf005cc70ae331a46385bf7ad25845c
# Parent  eee52c100996efd39fb3f9bc7b43c75808927f2a
[XEN] Change microcode_update function interface inside Xen.

Confine the knowledge that the buffer gets accessed without use of
proper guest handle accessors to a single file.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 xen/arch/x86/microcode.c          |   11 ++++++++---
 xen/arch/x86/platform_hypercall.c |    4 ++--
 2 files changed, 10 insertions(+), 5 deletions(-)

diff -r eee52c100996 -r 609b10b17bf0 xen/arch/x86/microcode.c
--- a/xen/arch/x86/microcode.c  Thu Oct 05 16:36:39 2006 +0100
+++ b/xen/arch/x86/microcode.c  Thu Oct 05 16:38:30 2006 +0100
@@ -455,7 +455,7 @@ out:
        return error;
 }
 
-int microcode_update(void *buf, unsigned long len)
+int microcode_update(XEN_GUEST_HANDLE(void) buf, unsigned long len)
 {
        int ret;
 
@@ -464,10 +464,15 @@ int microcode_update(void *buf, unsigned
                return -EINVAL;
        }
 
+       if (len != (typeof(user_buffer_size))len) {
+               printk(KERN_ERR "microcode: too much data\n");
+               return -E2BIG;
+       }
+
        mutex_lock(&microcode_mutex);
 
-       user_buffer = (void __user *) buf;
-       user_buffer_size = (int) len;
+       user_buffer = buf.p;
+       user_buffer_size = len;
 
        ret = do_microcode_update();
 
diff -r eee52c100996 -r 609b10b17bf0 xen/arch/x86/platform_hypercall.c
--- a/xen/arch/x86/platform_hypercall.c Thu Oct 05 16:36:39 2006 +0100
+++ b/xen/arch/x86/platform_hypercall.c Thu Oct 05 16:38:30 2006 +0100
@@ -104,8 +104,8 @@ long do_platform_op(XEN_GUEST_HANDLE(xen
 
     case XENPF_microcode_update:
     {
-        extern int microcode_update(void *buf, unsigned long len);
-        ret = microcode_update(op->u.microcode.data.p,
+        extern int microcode_update(XEN_GUEST_HANDLE(void), unsigned long len);
+        ret = microcode_update(op->u.microcode.data,
                                op->u.microcode.length);
     }
     break;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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