From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Woodhouse Subject: Re: [PATCH 10/7] [BLOCK] Add BLKDISCARD ioctl to allow userspace to discard sectors Date: Mon, 11 Aug 2008 21:52:10 +0100 Message-ID: <1218487930.2977.45.camel@pmac.infradead.org> References: <1218299181.26926.88.camel@pmac.infradead.org> <1218467472.2977.9.camel@pmac.infradead.org> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: Andrew Morton , Ric Wheeler , linux-fsdevel@vger.kernel.org, gilad@codefidence.com, matthew@wil.cx To: Jens Axboe Return-path: Received: from bombadil.infradead.org ([18.85.46.34]:52448 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753759AbYHKUwa (ORCPT ); Mon, 11 Aug 2008 16:52:30 -0400 In-Reply-To: <1218467472.2977.9.camel@pmac.infradead.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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@intel.com Intel Corporation