Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp49955ybe; Thu, 12 Sep 2019 15:26:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqyDH6foBSxxjtGRkt+8J3wQ+m4j+n5B8Jm+Q45ZxjhDfSJzvI3uGpQNnpynzXGSNDycwQkM X-Received: by 2002:a50:d556:: with SMTP id f22mr43487316edj.263.1568327171094; Thu, 12 Sep 2019 15:26:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568327171; cv=none; d=google.com; s=arc-20160816; b=mgf4sLLnwQZT3UUKM0eClglKiDB7RbyR7P2i7RNC3JPBjbdWwL5/XoZ2HhXqy0EaGb IeFZxvsXYm/RHparAMBNJSzOB9bswlg/380S529D71m5wwCYJ4HbJKD6CGKyQveoVPtJ rszXqfRjiS/fBiU3Vey/6JDiPWJIMGUjybBbc4WK6N75XITl9+frWP57wl1T3t8yEeht 1z11R8gPqBgpPIz0RVAHkGjgIFKpU69R0CHmEPrgj8bB5EiLARkFqk67Bfq1gxTOa2Ea qlQbE+2GB/ITFzsX/H6gjGmWf01YgoMWilLZ2nwh1uFLsV/u2GtxU4xw1HkZFFIcX4pt Q01Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=T1wnkQRnRUb/QFt2EBKqONJdyAol2HtCIkkBPzIPzA8=; b=ZX/2XElFCk3jzXUlZrKm8zHzB8oiAF4qONvlAo9y2zS2cFgVTpQqeNmuMWB7hcMT4b oHhoimYPzZf/4kQ3oT6j8d/ZiwYSqW5QQ109CJXaamiqb1/C4rGJT41oDWCXthud+8Om bicnCTqfOL8Uqd1d5gOtzwNSyi3PfhFVR7UN/Pw8cHUZkN7dUlnyTxFeDTA3Mgxb0XCB EpKhvTrCseSTBzyQK4g4HWorkltt3o+MFYgymn57dC4HAiFZe7+QidObNvMjeXO9EtY4 lAkDn3gFebVqtzQopHVBYOMfboM9kCkKgcHt//Jb2sOJ+2YXT0HY6UNXLSRFtp4nubMT f1yg== 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 a30si16955522eda.39.2019.09.12.15.25.46; Thu, 12 Sep 2019 15:26:11 -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 S1728617AbfILVbo (ORCPT + 99 others); Thu, 12 Sep 2019 17:31:44 -0400 Received: from mga14.intel.com ([192.55.52.115]:38897 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728577AbfILVbo (ORCPT ); Thu, 12 Sep 2019 17:31:44 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Sep 2019 14:31:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,492,1559545200"; d="scan'208";a="176092119" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by orsmga007.jf.intel.com with ESMTP; 12 Sep 2019 14:31:41 -0700 From: Wei Yang To: viro@zeniv.linux.org.uk Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Wei Yang Subject: [PATCH 1/3] fs/userfaultfd.c: remove a redundant check on end Date: Fri, 13 Sep 2019 05:31:08 +0800 Message-Id: <20190912213110.3691-1-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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