vserver 2.0 rc7
[linux-2.6.git] / drivers / macintosh / adb.c
index 5855bbf..7297c77 100644 (file)
@@ -755,7 +755,7 @@ static int adb_release(struct inode *inode, struct file *file)
 static ssize_t adb_read(struct file *file, char __user *buf,
                        size_t count, loff_t *ppos)
 {
-       int ret;
+       int ret = 0;
        struct adbdev_state *state = file->private_data;
        struct adb_request *req;
        wait_queue_t wait = __WAITQUEUE_INITIALIZER(wait,current);
@@ -765,9 +765,8 @@ static ssize_t adb_read(struct file *file, char __user *buf,
                return -EINVAL;
        if (count > sizeof(req->reply))
                count = sizeof(req->reply);
-       ret = verify_area(VERIFY_WRITE, buf, count);
-       if (ret)
-               return ret;
+       if (!access_ok(VERIFY_WRITE, buf, count))
+               return -EFAULT;
 
        req = NULL;
        spin_lock_irqsave(&state->lock, flags);
@@ -824,9 +823,8 @@ static ssize_t adb_write(struct file *file, const char __user *buf,
                return -EINVAL;
        if (adb_controller == NULL)
                return -ENXIO;
-       ret = verify_area(VERIFY_READ, buf, count);
-       if (ret)
-               return ret;
+       if (!access_ok(VERIFY_READ, buf, count))
+               return -EFAULT;
 
        req = (struct adb_request *) kmalloc(sizeof(struct adb_request),
                                             GFP_KERNEL);