Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp3298754ybx; Fri, 8 Nov 2019 17:30:47 -0800 (PST) X-Google-Smtp-Source: APXvYqy9XNBzxzt7okhwu6F2qaVyaeTzRqqRSKmGSeTMyhXcsnotp0PDXBr0j1YBBnKVjHfjBE0O X-Received: by 2002:a50:d713:: with SMTP id t19mr13908627edi.185.1573263047156; Fri, 08 Nov 2019 17:30:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573263047; cv=none; d=google.com; s=arc-20160816; b=Clv5FpH/rjupvLPBfzFAQWUKzHi50sHFHpEWtKUk9kpGv8jDGiaIcb9t6FDk2yEDVD sYNTfAQcvhqns/b+kedWOyEHeq2d3DKu73Lu5t/AvYw23hNWixNIFgCu9cIqE8jhTNnO +Gc6Xaa2LB+48EuBAirTjFvfxfQczbLcJy9bv0MSe98F9SbdJ/BKNicYsfH8gAl5qoOo z5dJjxKLuC49zrF93fQMyb2idtIEKJyAv0nZQMLjwoobtWTofd/HisZF37EubImrGVxV 0QX6EMMxUEj+VpiH2xEn2WCBY110N2n0aEonvUlMc+MnTZuyLpQS2rcLYGobthysgMfk pLQA== 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:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=pGP1mRt6HvkIHdUHLfILh9IOfF49YboAHeR6gZm7mIk=; b=Yi9Fr2IAL+Ng4h/xKCRfmMU6XyHVgZJYcdqA718MR7OxD0Nhegr9772ZvuQUauXjTE N0bdL2yCwdYx8p8xocpS0lvsK6nKZ+OdMjcnumOG/pHJhOaK5xMVzd1p3+OGCS8P3ABF 0yXnKWDwmygIq2wiVDf0KDZYfd3NlednNZUR7RQ3BBFKX6VCRQY4L1UBxRPVCKIMiW1V wRkMBHpgfrLrjBb+ygr41JpATxMHhc/N98UXMZQP259gsG0IugBKcI2mV6O5iQsCCxQ0 FnkDWQuuHe2HpBmJSHF/WKjV1yBj5+ZlCOVdtPijTB/igBArDW08Me88DKRpVMaVWqkU d0Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=r2cjSGJ9; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w26si4828366eju.48.2019.11.08.17.30.22; Fri, 08 Nov 2019 17:30:47 -0800 (PST) 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=pass header.i=@gmail.com header.s=20161025 header.b=r2cjSGJ9; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726130AbfKIB3k (ORCPT + 99 others); Fri, 8 Nov 2019 20:29:40 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:35372 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725943AbfKIB3k (ORCPT ); Fri, 8 Nov 2019 20:29:40 -0500 Received: by mail-wr1-f68.google.com with SMTP id p2so9049049wro.2; Fri, 08 Nov 2019 17:29:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to:user-agent; bh=pGP1mRt6HvkIHdUHLfILh9IOfF49YboAHeR6gZm7mIk=; b=r2cjSGJ9qPWPBj+dKmeqFCTpvfAjISqy97GsxpwNvXoYX8YHEqgztVmZv/zGkNxTM5 9KxXYQB2k2Bb2GLVadnfQe5GbCjnFIGGoJxP/sjpoWQsUSKznqtHiQ29icXVOJ3vhH76 5eSkAUeYIkFXVTurK116vpc4ocvXKt4A2wQgQ9xs1oPuncZGhhEpyyUPp3MdWeeC/fpn hyTzKxe1Pid+WwHdNY4XWJbSehHFNCmB8Xz7XKw0n0bz4eNpYUHNw/SIfS98ZyAjdUFc LyCLRPxK4hRGknNZbL7GigYon/o6peKad52tCOJNE+S1Y8ngWj4DWfKY/D2S5jwOBZyF k6QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:reply-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=pGP1mRt6HvkIHdUHLfILh9IOfF49YboAHeR6gZm7mIk=; b=cXsk+/NNd9vhue1mexMqVXBguzcvF82Mj3JHZm2iw5fjvS99E3rz43GFoHu0kb/uYD zPwvviMgzlJtUs8fDHdOXZ2vBZCmljnb2Gk0IeYK5GCsGqiCrbsP1bi2CDRPoyVRGQqI MfqljA9I0b9miSeSwVPQL4vsYBbtUeuymkfq3wVZix5jmvlZniErSbGQrZlBI/GwBIs9 Eq2TLDV5igFhX1xiLm+UtLaGXrsh8KpzasN6h0hPZ6cEjMmd9KmiSjMC5Ac/T9E4K5JX 34xZQttYGeDF4zLRx9iD4r0Lnqw2clghJn1GDlEjj5cTVfEmJSBEeL5GhwGN0qmA7Apt aHZA== X-Gm-Message-State: APjAAAVR07F1GH180NW7vE/NYCWPGDKa0oUAbDjMmCNKMFxQbq725B14 FnAM2BxOWei6vwYGZ7NqJZQ= X-Received: by 2002:a05:6000:104:: with SMTP id o4mr4783754wrx.309.1573262978063; Fri, 08 Nov 2019 17:29:38 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id d4sm7197882wrw.83.2019.11.08.17.29.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Nov 2019 17:29:37 -0800 (PST) Date: Sat, 9 Nov 2019 01:29:36 +0000 From: Wei Yang To: Wei Yang Cc: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] fs/userfaultfd.c: remove a redundant check on end Message-ID: <20191109012936.fkqdczhl3sykius7@master> Reply-To: Wei Yang References: <20190912213110.3691-1-richardw.yang@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190912213110.3691-1-richardw.yang@linux.intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 13, 2019 at 05:31:08AM +0800, Wei Yang wrote: >For the ending vma, there is a check to make sure the end is huge page >aligned. > >The *if* check makes sure vm_start < end <= vm_end. While the first half >is not necessary, because the *for* clause makes sure vm_start < end. > >This patch just removes it. > Does this one look good? >Signed-off-by: Wei Yang >--- > fs/userfaultfd.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > >diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c >index 653d8f7c453c..9ce09ac619a2 100644 >--- a/fs/userfaultfd.c >+++ b/fs/userfaultfd.c >@@ -1402,8 +1402,7 @@ static int userfaultfd_register(struct userfaultfd_ctx *ctx, > * If this vma contains ending address, and huge pages > * check alignment. > */ >- if (is_vm_hugetlb_page(cur) && end <= cur->vm_end && >- end > cur->vm_start) { >+ if (is_vm_hugetlb_page(cur) && end <= cur->vm_end) { > unsigned long vma_hpagesize = vma_kernel_pagesize(cur); > > ret = -EINVAL; >-- >2.17.1 -- Wei Yang Help you, Help me