Re: [PATCH 10/7] [BLOCK] Add BLKDISCARD ioctl to allow userspace to discard sectors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2008-08-11 at 16:11 +0100, David Woodhouse wrote:
> +               if (get_user(start, (uint64_t __user *)(arg)) ||
> +                   get_user(len, (uint64_t __user *)(arg+8)))

Hm, I don't think that works on any 32-bit platform except PowerPC.
Although the patch at http://david.woodhou.se/i386-getuser8.patch might
fix it for i386, if someone with access to a suitable box wants to test
it for me.

Still, this is probably a better plan...

--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -323,13 +323,12 @@ int blkdev_ioctl(struct inode *inode, struct file
*file, u
                return 0;
 
        case BLKDISCARD: {
-               uint64_t start, len;
+               uint64_t range[2];
 
-               if (get_user(start, (uint64_t __user *)(arg)) ||
-                   get_user(len, (uint64_t __user *)(arg+8)))
+               if (copy_from_user(range, arg, sizeof(range)))
                        return -EFAULT;
 
-               return blk_ioctl_discard(bdev, start, len);
+               return blk_ioctl_discard(bdev, range[0], range[1]);
        }
 
        case HDIO_GETGEO: {


-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@xxxxxxxxx                              Intel Corporation



--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux