Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp585093ybm; Wed, 22 May 2019 08:13:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqxR692i1NJV6yLA2Vr5kk7f2IOHQXe1BQ0hG4FCu0q1pYs1Ke/uwhlmheweopHDJ2Tz20Rz X-Received: by 2002:a17:902:12f:: with SMTP id 44mr44744395plb.137.1558538003444; Wed, 22 May 2019 08:13:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558538003; cv=none; d=google.com; s=arc-20160816; b=lYTtqZvcuinxWVty8ExkJz4ODkXOQT8netCq1k5ZToVjxxWs34jAFAPLL1UdTJY5dJ g6+v8FrreU+s9n7q+7+/ru7lq/JPzTtWlCGBSUhEpOplME6zMm+kD/f5zhbK7A9GLA23 g7ge4TWyRSLMJFu8XPV9jDWGK5oENAa3uEcfgJbeot/waz0AyAeh0RBLAzVIxX5WYlQJ vFHMQRRWolVs6ztybZ/9iNfG95nRB6LPpNajioAKPvOfSX/TTylDLUlL8xJmITpPcGG1 uqGRk+OIYRbvpdgsRDLljJUkSi8+McEyZldN2qTo9iLOmuA512wkbts5jnwvYJ+uXGXP RlZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=FEpLTp6t9Bj8cEZnHYwVHtekMHW40hqnqkWrqhgRy+w=; b=Nyj+JSX3+Z6Ew4mYz0hgICPrQsSiUnaclbySxnb8B7N5KbVWfIe78Nrz7XS3GyBgng G/KeaOl+hFBPFbyXgxom1nqKmtIZevmkiTU+BlnNlR1v6z6MSYqHNhonvmTAdnUnK4kg 6oMH/TYvyrgvx+u3dU/r1itPor/pHrpbRJA+UPbUTmXcYZHnJpO+QAfiDI1mVkK8CRzY rhMgEj83Qg+mjRsiQ31KLZJCfLM6CuO2WWrtVrMVMbAp5N4linhYAdLoyH8enEqXDhoC ZC3W84bugWe4Momwicc+VYXyaGA9vuxGtIP4mF+HgjaaL4VymTV9jbu+Moj7bN0YG2zT 81+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=QEF+xA3x; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d191si24316648pga.454.2019.05.22.08.12.57; Wed, 22 May 2019 08:13:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=QEF+xA3x; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729879AbfEVPKD (ORCPT + 99 others); Wed, 22 May 2019 11:10:03 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:38360 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729856AbfEVPJ6 (ORCPT ); Wed, 22 May 2019 11:09:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=FEpLTp6t9Bj8cEZnHYwVHtekMHW40hqnqkWrqhgRy+w=; b=QEF+xA3x6vvUPujuP05sXLntB 0qvtE9Bn/WTayOl8HqiYAfphd/jJWWP6QKE4USd2xYeKvHr6Le15YeRKNcFL3uJzvIs6WGZn//JRY gLKB3mBWGGOX3jaREH1K5eGZuh7PjnWIC5qtY7HQwwHR7yP6YXNdoQWG8jtR5z7vwZvy6gij8LEez q3b8aeHNn0hnobvFBvVaDwYJukRnXn21FwfvhSCe3tF+QPqkpYA2DDWZui9PUmGAyf69QU1fVfhyA z25C8ODYNMWQaPQndCv19GIigt28GmabipvGE28egqs5SMCZ2CzEQU7vvPKPalvnYkg+2AgQtCvh3 Me2W2fjlw==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1hTSsQ-00058J-7f; Wed, 22 May 2019 15:09:58 +0000 Date: Wed, 22 May 2019 08:09:58 -0700 From: Matthew Wilcox To: sunqiuyang Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, yuchao0@huawei.com Subject: Re: [PATCH v4 1/1] f2fs: ioctl for removing a range from F2FS Message-ID: <20190522150958.GC6738@bombadil.infradead.org> References: <20190522040530.37886-1-sunqiuyang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190522040530.37886-1-sunqiuyang@huawei.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 22, 2019 at 12:05:30PM +0800, sunqiuyang wrote: > +static int f2fs_ioc_resize_fs(struct file *filp, unsigned long arg) > +{ > + struct f2fs_sb_info *sbi = F2FS_I_SB(file_inode(filp)); > + __u64 block_count; > + int ret; > + > + if (!capable(CAP_SYS_ADMIN)) > + return -EPERM; > + > + if (f2fs_readonly(sbi->sb)) > + return -EROFS; > + > + if (copy_from_user(&block_count, (__u64 __user *)arg, sizeof(__u64))) > + return -EFAULT; You can just call get_user() here.