Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
[sfrench/cifs-2.6.git] / arch / x86 / kernel / ptrace.c
index 3c5bbe8e412087f15cf3280a43c921fe32f54e0a..066e5b01a7e086a515a405e81ec2eb7baef2921b 100644 (file)
@@ -42,6 +42,7 @@
 #include <asm/traps.h>
 #include <asm/syscall.h>
 #include <asm/fsgsbase.h>
+#include <asm/io_bitmap.h>
 
 #include "tls.h"
 
@@ -697,7 +698,9 @@ static int ptrace_set_debugreg(struct task_struct *tsk, int n,
 static int ioperm_active(struct task_struct *target,
                         const struct user_regset *regset)
 {
-       return target->thread.io_bitmap_max / regset->size;
+       struct io_bitmap *iobm = target->thread.io_bitmap;
+
+       return iobm ? DIV_ROUND_UP(iobm->max, regset->size) : 0;
 }
 
 static int ioperm_get(struct task_struct *target,
@@ -705,12 +708,13 @@ static int ioperm_get(struct task_struct *target,
                      unsigned int pos, unsigned int count,
                      void *kbuf, void __user *ubuf)
 {
-       if (!target->thread.io_bitmap_ptr)
+       struct io_bitmap *iobm = target->thread.io_bitmap;
+
+       if (!iobm)
                return -ENXIO;
 
        return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
-                                  target->thread.io_bitmap_ptr,
-                                  0, IO_BITMAP_BYTES);
+                                  iobm->bitmap, 0, IO_BITMAP_BYTES);
 }
 
 /*