Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5240452ybi; Tue, 28 May 2019 09:40:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqwioQPQjvPZ3ZHdNeNJJyipDLTMKpLkbPQ23326K+NetzOqzOs1UXjr6P0jo3IqEjgaGqie X-Received: by 2002:a62:3145:: with SMTP id x66mr119398030pfx.223.1559061630835; Tue, 28 May 2019 09:40:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559061630; cv=none; d=google.com; s=arc-20160816; b=wQ9FKqt7NkyYFy7PiWmGOPPZD/OEYxWAA0sUWLWzisW+zzZwGM1uLUuuQUNukh/+jD f0mEV/LhDXEzpWSFF2dsJBu8qw7eCiwYdVK/o680T2X6N+VUZ4DWv1jZh3qHJ7F9g6qK jWm1CDOzNR53PiFHInvRtqEndKyLcWN2QP1PzQ/rBZBkqYBfI1Gdx++KFlq54L9Cdqax P4hCinrWfe2RBIcXXXQL1uVQLY/t907zA7/T0u2JGN48i7J/rpk9ApBAncf1WaaFgM7Y qQZ0yVVy5KLDQVgqqsBU5jpccalQtAY6il55lLbF+x4bE3DV9odxD9gceFVmxJ8IQVTp sRSA== 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=qsNqiTxTjHWC9UYKJ2H7Vx/bDfTKWMkUr8SIkDxm9oY=; b=cfXtD+fFJT4ggfwNNPKeO5DmDF/oiQxZ0gw5s1+GuM9g3gE6aCHz0keFVa0NHASJii Wxksd7nuVVqO4sF8+cQHMJldxdYQT4lCDIzwJ0QGlMdHNotlM6Nvh5h2Wn/7hbL1TLgx qSGmVJDwQbCkRxPChtHiMIhjRcLYHbSCTN8blJkWjE++xLxy1QVU1MI+WQZswTq7NSWz c+wFeF5eTXCgfBWkF7kGN7lEmSt80fOXROWxawEtypZX+DbOcrXgUQReF38BiTbVj6d8 /j0sxMC2Nxdoi9/hFM2N4uAkLTqUpDEtnZ8uCoQye4Pm85SnCi7R/iERDFdo5kYZZ58n LqqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=D77UjDBd; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f13si22172088pgs.90.2019.05.28.09.40.16; Tue, 28 May 2019 09:40:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=D77UjDBd; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726911AbfE1Qjd (ORCPT + 99 others); Tue, 28 May 2019 12:39:33 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:49688 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726600AbfE1Qjd (ORCPT ); Tue, 28 May 2019 12:39:33 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x4SGYtBE171898; Tue, 28 May 2019 16:39:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2018-07-02; bh=qsNqiTxTjHWC9UYKJ2H7Vx/bDfTKWMkUr8SIkDxm9oY=; b=D77UjDBdpj4/eLkXI9XQLAWQ1c2jsa/OGsCVpRyMyizUDro1etdTkWJ2x2n6rYL81OrL WmsJ1x7wza2G4ab5YikQxqb7O44MTTXbQeQh5weuF2ogBSmLXXXv3s264vCH+j2CcdE+ /CUUFqcOHcJly/gDLM6x46ui67WasOGUJzeOSmfQ4g4c0E8F6Rto2LInBpdcZSQ4Pfoo w6sxmmgQfuYLh1xLR48q36SYy/NXxSimhg/HCyVDsm/KdruU12KU4XZSWtzDjuanb44G QeKiQSQ7eU8M3/AunN3z8p94fK7kRvKL9ozYcBJ7njGtb5Daztp4eDq3tHesT1MRA5bV ZA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 2spw4tcgf7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 May 2019 16:39:21 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x4SGZwBq173077; Tue, 28 May 2019 16:37:21 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3020.oracle.com with ESMTP id 2sr31us1rn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 May 2019 16:37:21 +0000 Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x4SGbKNf014893; Tue, 28 May 2019 16:37:20 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 28 May 2019 09:37:20 -0700 Date: Tue, 28 May 2019 09:37:18 -0700 From: "Darrick J. Wong" To: Amir Goldstein Cc: Dave Chinner , Christoph Hellwig , Olga Kornievskaia , Luis Henriques , Al Viro , linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org, ceph-devel@vger.kernel.org, linux-api@vger.kernel.org Subject: Re: [PATCH v2 8/8] vfs: remove redundant checks from generic_remap_checks() Message-ID: <20190528163718.GI5221@magnolia> References: <20190526061100.21761-1-amir73il@gmail.com> <20190526061100.21761-9-amir73il@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190526061100.21761-9-amir73il@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9270 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905280106 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9270 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905280106 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Sun, May 26, 2019 at 09:10:59AM +0300, Amir Goldstein wrote: > The access limit checks on input file range in generic_remap_checks() > are redundant because the input file size is guarantied to be within guaranteed ^^^^^^^^^^ > limits and pos+len are already checked to be within input file size. > > Beyond the fact that the check cannot fail, if it would have failed, > it could return -EFBIG for input file range error. There is no precedent > for that. -EFBIG is returned in syscalls that would change file length. > > Signed-off-by: Amir Goldstein > --- > mm/filemap.c | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/mm/filemap.c b/mm/filemap.c > index 1852fbf08eeb..7e1aa36d57a2 100644 > --- a/mm/filemap.c > +++ b/mm/filemap.c > @@ -3000,10 +3000,6 @@ int generic_remap_checks(struct file *file_in, loff_t pos_in, > return -EINVAL; > count = min(count, size_in - (uint64_t)pos_in); > > - ret = generic_access_check_limits(file_in, pos_in, &count); I suspect you could fold generic_access_check_limits into its only caller, then... --D > - if (ret) > - return ret; > - > ret = generic_write_check_limits(file_out, pos_out, &count); > if (ret) > return ret; > -- > 2.17.1 >