ia64/xen-unstable

changeset 11758:9dabb06c66f5

[XEN] Fix memtype accessor domctls.
From: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Thu Oct 05 16:42:27 2006 +0100 (2006-10-05)
parents 609b10b17bf0
children 79b56c02b836
files xen/arch/x86/platform_hypercall.c
line diff
     1.1 --- a/xen/arch/x86/platform_hypercall.c	Thu Oct 05 16:38:30 2006 +0100
     1.2 +++ b/xen/arch/x86/platform_hypercall.c	Thu Oct 05 16:42:27 2006 +0100
     1.3 @@ -58,12 +58,13 @@ long do_platform_op(XEN_GUEST_HANDLE(xen
     1.4              op->u.add_memtype.nr_mfns,
     1.5              op->u.add_memtype.type,
     1.6              1);
     1.7 -        if ( ret > 0 )
     1.8 +        if ( ret >= 0 )
     1.9          {
    1.10              op->u.add_memtype.handle = 0;
    1.11              op->u.add_memtype.reg    = ret;
    1.12 -            (void)copy_to_guest(u_xenpf_op, op, 1);
    1.13 -            ret = 0;
    1.14 +            ret = copy_to_guest(u_xenpf_op, op, 1) ? -EFAULT : 0;
    1.15 +            if ( ret != 0 )
    1.16 +                mtrr_del_page(ret, 0, 0);
    1.17          }
    1.18      }
    1.19      break;
    1.20 @@ -75,7 +76,7 @@ long do_platform_op(XEN_GUEST_HANDLE(xen
    1.21              && (int)op->u.del_memtype.reg >= 0)
    1.22          {
    1.23              ret = mtrr_del_page(op->u.del_memtype.reg, 0, 0);
    1.24 -            if (ret > 0)
    1.25 +            if ( ret > 0 )
    1.26                  ret = 0;
    1.27          }
    1.28          else
    1.29 @@ -96,8 +97,7 @@ long do_platform_op(XEN_GUEST_HANDLE(xen
    1.30              op->u.read_memtype.mfn     = mfn;
    1.31              op->u.read_memtype.nr_mfns = nr_mfns;
    1.32              op->u.read_memtype.type    = type;
    1.33 -            (void)copy_to_guest(u_xenpf_op, op, 1);
    1.34 -            ret = 0;
    1.35 +            ret = copy_to_guest(u_xenpf_op, op, 1) ? -EFAULT : 0;
    1.36          }
    1.37      }
    1.38      break;