Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1084291pxb; Tue, 3 Nov 2020 22:46:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJxVi9P7lpI13zg6tPx53syh7pAWH6Giy8DpKWToqZ7G8WuUg6vx65cK71uDUzD93DGcSiDY X-Received: by 2002:a05:6402:54c:: with SMTP id i12mr2114371edx.9.1604472366518; Tue, 03 Nov 2020 22:46:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604472366; cv=none; d=google.com; s=arc-20160816; b=y0DM8BoYvIiRwweQcHIGRe+ojukhYtW6IU8+XKM+6l58NxmYKDeDSygozXYIzGX/WK 9RhT/Y0CPkH1h7Mei8hE/U+/N+nCaijcyrYPq9DX7gyoxlTII/V3imIoSIFHIll5Nxps R3Q7Ott0GXuYaKLePgjCgY3CSvZbEv4PN9y70EKsvVy78bt1kMF8PW9I7drcdWXIoh3a tQLaZ2zSL6GWPwg1qynaykYGBHqNAltp3tO1d7IrUSW/8aEwikivukqMdX9JUg9ofyLd lavM2TSZ7hGlQvNq13feZ9z84frnDMJVDLH431v3LEe+oG1z+5fXLqDjRsufv0iTxfUO R40g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=emGDw4sf0R+y7qG3ui4I1SNddsQ6uq9/SNXPre63a9k=; b=lA+GwVsK5t1LDfXRov656ERPeXwNC8iKOUCfsLMLZaRX/ty/0akVxhV6L4U1/9VmYf CfpHDLRG7P6EtoVx4JH7+zFRNJphcFcZOr+r5A6BrYR1U/cPKaCL3MWnPHj+qIIV+JZY pRh9BQdE2cJzAadJ38EIUN3wy/X/9J6rBtd4Pt2rh1/X3yQ9IhmHA+wENP+aPq8Jn0bz 8ILWOPLhJE5aTu7N8MygRi+grErDh4t4ZIoNdkSIoROBmWQ2aeclZPh3kIytVhbus4ID Gk0XsAuk8rYMLU5GUWcDchV6KP5L9K0OC0nWmB70uDy09AqwK6EUx4Qk0G1pSFAJaSWp R4PA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gr13si761516ejb.428.2020.11.03.22.45.44; Tue, 03 Nov 2020 22:46:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726691AbgKDGnd (ORCPT + 99 others); Wed, 4 Nov 2020 01:43:33 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:7046 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726225AbgKDGnd (ORCPT ); Wed, 4 Nov 2020 01:43:33 -0500 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CQxtm1GG2zhZN1; Wed, 4 Nov 2020 14:43:28 +0800 (CST) Received: from szvp000203569.huawei.com (10.120.216.130) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.487.0; Wed, 4 Nov 2020 14:43:21 +0800 From: Chao Yu To: CC: , , , Chao Yu Subject: [PATCH v2 1/2] f2fs: avoid unneeded data copy in f2fs_ioc_move_range() Date: Wed, 4 Nov 2020 14:43:09 +0800 Message-ID: <20201104064310.15769-1-yuchao0@huawei.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.120.216.130] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fields in struct f2fs_move_range won't change in f2fs_ioc_move_range(), let's avoid copying this structure's data to userspace. Signed-off-by: Chao Yu --- fs/f2fs/file.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 52417a2e3f4f..22ae8ae0072f 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -2898,12 +2898,6 @@ static int f2fs_ioc_move_range(struct file *filp, unsigned long arg) range.pos_out, range.len); mnt_drop_write_file(filp); - if (err) - goto err_out; - - if (copy_to_user((struct f2fs_move_range __user *)arg, - &range, sizeof(range))) - err = -EFAULT; err_out: fdput(dst); return err; -- 2.26.2