Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2007703ybp; Sat, 12 Oct 2019 02:17:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqyL5NeyXjx6MmJNjZ9uW0DhuQ+/1503pzdHx+IO9gWn9SX0PBlSxFx8cNMCykfXBDylDgFP X-Received: by 2002:a05:6402:656:: with SMTP id u22mr18110156edx.70.1570871846368; Sat, 12 Oct 2019 02:17:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570871846; cv=none; d=google.com; s=arc-20160816; b=VRt70cCTI+RttQtoHN8SivdkzAptU2OOtyNt9IpCJcRPGtaFxl1TP7DrXk7rJ4oi0K 7MFkrPEJXuGb2rNOOMFYvWl9mVpb/F3hmQLV7OJfrmLA4nlU1IQKYFIpZ0Tx6sImfyYP rtNjr6sPkipRmKe56glMmyHkPfmDFF8JZ9O5QdEIbbrKX3KHjr9cxiORu36IEQCxnIDB OLoVKUwe/TTDgEhjR+dKoj63374KrfMPgjljmkWAVftvSFmpLy2i4FBl9aVorSiOSBJb OfXHPshfvJ0CXU6GHK3Lx0D/21mDpUUAGlLtNSHfHQhvgXGfRwMAA1r894p7tu9y2Q6e nHjA== 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; bh=9ZodTO1xwYzdPXxL5L64CNHg/LE5y1x3k4N6ZGmTGn8=; b=hIbzKlkvRBJVpIOi8nuOaRuiY7XtR02bBYMO3YFi5rVGJc7kdqqApo/x7Ixuzksnuc zTi4w7UIQa8t9zZGcRWSZFfZaw9fiWlvpfnKfZ8Ef4Pl8ek2fRCWRpDigQNsxEAxBlUP uyjCipvFvRi6ifIr1jM+ia0fCPyMTuxQjtHqx4KzUyb+Uep5gmVtTiqAmKwTHGDKM66u hmW+JiMyxg+75DTgjFubegkS3f40SWEoXaoasztwNYYMw0n8nwT7kJFcVeYXBZBmOTYY y7iVR75HmNKPXF3P7Pd/fCkCjNKQYGheq6R7M0KMG1W5SHbir0Ss51hNjMlWr8GUqHDG 62Uw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id os6si6810195ejb.224.2019.10.12.02.17.01; Sat, 12 Oct 2019 02:17:26 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729004AbfJLJQX (ORCPT + 99 others); Sat, 12 Oct 2019 05:16:23 -0400 Received: from mga01.intel.com ([192.55.52.88]:43241 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727507AbfJLJQX (ORCPT ); Sat, 12 Oct 2019 05:16:23 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Oct 2019 02:16:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,287,1566889200"; d="scan'208";a="188549955" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by orsmga008.jf.intel.com with ESMTP; 12 Oct 2019 02:16:20 -0700 Date: Sat, 12 Oct 2019 17:16:04 +0800 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: <20191012091604.GB6047@richard> 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: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ping for comment :-) 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. > >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