diff options
author | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2006-10-05 16:38:30 +0100 |
---|---|---|
committer | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2006-10-05 16:38:30 +0100 |
commit | d9535802e3179138b60eabc9bba3ad36d23aad47 (patch) | |
tree | 9472ce02eacb78f7df9338d2b9aec87bc9e1a180 | |
parent | 86c981c50cb7e01055adad91fefdb72571f7c1c7 (diff) | |
download | xen-d9535802e3179138b60eabc9bba3ad36d23aad47.tar.gz xen-d9535802e3179138b60eabc9bba3ad36d23aad47.tar.bz2 xen-d9535802e3179138b60eabc9bba3ad36d23aad47.zip |
[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@novell.com>
-rw-r--r-- | xen/arch/x86/microcode.c | 11 | ||||
-rw-r--r-- | xen/arch/x86/platform_hypercall.c | 4 |
2 files changed, 10 insertions, 5 deletions
diff --git a/xen/arch/x86/microcode.c b/xen/arch/x86/microcode.c index 9c4b4d66f8..3dcac7d124 100644 --- a/xen/arch/x86/microcode.c +++ b/xen/arch/x86/microcode.c @@ -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 long len) return -EINVAL; } + if (len != (typeof(user_buffer_size))len) { + printk(KERN_ERR "microcode: too much data\n"); + return -E2BIG; + } + mutex_lock(µcode_mutex); - user_buffer = (void __user *) buf; - user_buffer_size = (int) len; + user_buffer = buf.p; + user_buffer_size = len; ret = do_microcode_update(); diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hypercall.c index 098c847112..1b886caab2 100644 --- a/xen/arch/x86/platform_hypercall.c +++ b/xen/arch/x86/platform_hypercall.c @@ -104,8 +104,8 @@ long do_platform_op(XEN_GUEST_HANDLE(xen_platform_op_t) u_xenpf_op) 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; |