Pull button into test branch
[pandora-kernel.git] / arch / um / sys-i386 / ldt.c
index 1fa09a7..5db7737 100644 (file)
@@ -3,8 +3,6 @@
  * Licensed under the GPL
  */
 
-#include "linux/stddef.h"
-#include "linux/config.h"
 #include "linux/sched.h"
 #include "linux/slab.h"
 #include "linux/types.h"
@@ -107,7 +105,7 @@ long write_ldt_entry(struct mm_id * mm_idp, int func, struct user_desc * desc,
                 * So we need to switch child's mm into our userspace, then
                 * later switch back.
                 *
-                * Note: I'm unshure: should interrupts be disabled here?
+                * Note: I'm unsure: should interrupts be disabled here?
                 */
                if(!current->active_mm || current->active_mm == &init_mm ||
                   mm_idp != &current->active_mm->context.skas.id)
@@ -129,9 +127,7 @@ long write_ldt_entry(struct mm_id * mm_idp, int func, struct user_desc * desc,
                        pid = userspace_pid[cpu];
                }
 
-               res = ptrace(PTRACE_LDT, pid, 0, (unsigned long) &ldt_op);
-               if(res)
-                       res = errno;
+               res = os_ptrace_ldt(pid, 0, (unsigned long) &ldt_op);
 
                if(proc_mm)
                        put_cpu();
@@ -170,7 +166,7 @@ static long read_ldt_from_host(void __user * ptr, unsigned long bytecount)
        struct ptrace_ldt ptrace_ldt = (struct ptrace_ldt) {
                        .func = 0,
                        .bytecount = bytecount,
-                       .ptr = (void *)kmalloc(bytecount, GFP_KERNEL)};
+                       .ptr = kmalloc(bytecount, GFP_KERNEL)};
        u32 cpu;
 
        if(ptrace_ldt.ptr == NULL)
@@ -181,8 +177,7 @@ static long read_ldt_from_host(void __user * ptr, unsigned long bytecount)
         */
 
        cpu = get_cpu();
-       res = ptrace(PTRACE_LDT, userspace_pid[cpu], 0,
-                    (unsigned long) &ptrace_ldt);
+       res = os_ptrace_ldt(userspace_pid[cpu], 0, (unsigned long) &ptrace_ldt);
        put_cpu();
        if(res < 0)
                goto out;
@@ -427,12 +422,11 @@ void ldt_get_host_info(void)
                        size++;
        }
 
-       if(size < sizeof(dummy_list)/sizeof(dummy_list[0])) {
+       if(size < ARRAY_SIZE(dummy_list))
                host_ldt_entries = dummy_list;
-       }
        else {
                size = (size + 1) * sizeof(dummy_list[0]);
-               host_ldt_entries = (short *)kmalloc(size, GFP_KERNEL);
+               host_ldt_entries = kmalloc(size, GFP_KERNEL);
                if(host_ldt_entries == NULL) {
                        printk("ldt_get_host_info: couldn't allocate host ldt list\n");
                        goto out_free;