ia64/xen-unstable

changeset 11757:609b10b17bf0

[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>
author kfraser@localhost.localdomain
date Thu Oct 05 16:38:30 2006 +0100 (2006-10-05)
parents eee52c100996
children 9dabb06c66f5
files xen/arch/x86/microcode.c xen/arch/x86/platform_hypercall.c
line diff
     1.1 --- a/xen/arch/x86/microcode.c	Thu Oct 05 16:36:39 2006 +0100
     1.2 +++ b/xen/arch/x86/microcode.c	Thu Oct 05 16:38:30 2006 +0100
     1.3 @@ -455,7 +455,7 @@ out:
     1.4  	return error;
     1.5  }
     1.6  
     1.7 -int microcode_update(void *buf, unsigned long len)
     1.8 +int microcode_update(XEN_GUEST_HANDLE(void) buf, unsigned long len)
     1.9  {
    1.10  	int ret;
    1.11  
    1.12 @@ -464,10 +464,15 @@ int microcode_update(void *buf, unsigned
    1.13  		return -EINVAL;
    1.14  	}
    1.15  
    1.16 +	if (len != (typeof(user_buffer_size))len) {
    1.17 +		printk(KERN_ERR "microcode: too much data\n");
    1.18 +		return -E2BIG;
    1.19 +	}
    1.20 +
    1.21  	mutex_lock(&microcode_mutex);
    1.22  
    1.23 -	user_buffer = (void __user *) buf;
    1.24 -	user_buffer_size = (int) len;
    1.25 +	user_buffer = buf.p;
    1.26 +	user_buffer_size = len;
    1.27  
    1.28  	ret = do_microcode_update();
    1.29  
     2.1 --- a/xen/arch/x86/platform_hypercall.c	Thu Oct 05 16:36:39 2006 +0100
     2.2 +++ b/xen/arch/x86/platform_hypercall.c	Thu Oct 05 16:38:30 2006 +0100
     2.3 @@ -104,8 +104,8 @@ long do_platform_op(XEN_GUEST_HANDLE(xen
     2.4  
     2.5      case XENPF_microcode_update:
     2.6      {
     2.7 -        extern int microcode_update(void *buf, unsigned long len);
     2.8 -        ret = microcode_update(op->u.microcode.data.p,
     2.9 +        extern int microcode_update(XEN_GUEST_HANDLE(void), unsigned long len);
    2.10 +        ret = microcode_update(op->u.microcode.data,
    2.11                                 op->u.microcode.length);
    2.12      }
    2.13      break;