Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp267148pxb; Wed, 20 Jan 2021 06:40:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJxMXyho9ZCRY50lxTrKyMsDi2jhJcU0YmFshDRg5Zt1kM4rIAwfIC2TGyU528T9b2Ik+D6L X-Received: by 2002:a17:907:2138:: with SMTP id qo24mr6249623ejb.425.1611153614459; Wed, 20 Jan 2021 06:40:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611153614; cv=none; d=google.com; s=arc-20160816; b=BsYuUm/X6HRWJtOGSPAa+SbuCxb6xIINu0qX7DX4W45TXLk6FmM7QiNKbivBbCBlAr T2LAQj8GtiFhQWNsIjxGdq/2iHlRomuqYnHsxsUMkMWRhuKeiuJLPxvVP/3Xrf8IySSz fsKXhQ+lrvkRjiSikVJbFo6CuqGJbz971X5sBCW8UTpONoeuiK9ZbFnsrkKXdM4oxmES mgXk9wmtxlRtq9hxh8mif/63rISrUZkEVlryLQHlH4AxPkb60obDnVYQ0LsdUGN4Gm2F PYUcZwVgpnOQOXCyp+5f/+JxBckkeDBtv/QltLK8a+qxap7sGIF4996b2xEGFxKPC0nZ QaPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=zyZgW3tMOGEdxel84c7D8sjRXvxVjfRabn9dar8pn/Q=; b=xZqpusMZRg8m4SYMDGIoFbinYbWuGSGjMXS6ZpBa3gHimINiJiXzBqHfD2/H/BJxJc SC2INXakXUoqeHv68rBPjSiyeffM0NIbERfewTqFYnYRzH5hl1DkE9YcpuOD+jmAqE+n VeZKHj6xuA07vv6udU4CCeGp1NlBJH/cQKikCzJRia8WIdoN+evGzrWHYBxPXp3UvV4L VlBMzWwc3e5f+KQDqCQho/ZgS2lCfkgMsKhPdVi8iCGTfeVUZgMkAu/ux+nb1233wovu 2AD28I3P1BaG905CeY0NrWtw5vuXQ0cUJey+IBwbwA6UnqrKcs5wtJlg5by+ouVe6Jt4 koAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qztC3BI2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j8si934904edt.239.2021.01.20.06.39.48; Wed, 20 Jan 2021 06:40:14 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qztC3BI2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390709AbhATOgM (ORCPT + 99 others); Wed, 20 Jan 2021 09:36:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:40460 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389307AbhATOaG (ORCPT ); Wed, 20 Jan 2021 09:30:06 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8685E23329; Wed, 20 Jan 2021 14:29:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611152966; bh=JHHd5XKXRsuaWfamSWN2tPvthY11GXk7QS21FxFrvdg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qztC3BI2X5X6WkB/wDGbA0u3PZ8r4+j+741azXlQHQxOIjUV8Tfv/1HuSuSw/rSXh LzkyEsv2Mkals4Xn8UpHYsAm7yZd27wk/nb1NEadNdBGSj/NxOj2SajfYS1IauzIGd TW2bIZR37X1v0OI7pekCjusxa2mC4cyMKwJo42+eEdCuKWsCJeE68RlIlF1n2cwz1r R5SswsxU3pXQ6h515wzphxcNZqRnO/UJe03Vdhtndx87n04bf2P7IpoQer88QbC4dr czZwgSMU1pHMU0qTvIw2qK9kYvDAzSieTa+hicKWmiVQwt1XNzigzsE40KKVX5Cenz 2OJ1dYFFLe6Kw== Date: Wed, 20 Jan 2021 16:29:20 +0200 From: Jarkko Sakkinen To: Tianjia Zhang Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Andrew Morton , Shuah Khan , haitao.huang@intel.com, Kai Huang , x86@kernel.org, linux-sgx@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, Jia Zhang Subject: Re: [PATCH] mm: Optimizing error condition detection in do_mprotect_pkey() Message-ID: References: <20210118133310.98375-1-tianjia.zhang@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210118133310.98375-1-tianjia.zhang@linux.alibaba.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 18, 2021 at 09:33:10PM +0800, Tianjia Zhang wrote: > Obviously, the error variable detection of the if statement is > for the mprotect callback function, so it is also put into the > scope of calling callbck. > > Reported-by: Jia Zhang > Signed-off-by: Tianjia Zhang No fixes tag, no description what this commit does. Nothing makes sense to me. /Jarkko > --- > mm/mprotect.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/mm/mprotect.c b/mm/mprotect.c > index ab709023e9aa..94188df1ee55 100644 > --- a/mm/mprotect.c > +++ b/mm/mprotect.c > @@ -617,10 +617,11 @@ static int do_mprotect_pkey(unsigned long start, size_t len, > if (tmp > end) > tmp = end; > > - if (vma->vm_ops && vma->vm_ops->mprotect) > + if (vma->vm_ops && vma->vm_ops->mprotect) { > error = vma->vm_ops->mprotect(vma, nstart, tmp, newflags); > - if (error) > - goto out; > + if (error) > + goto out; > + } > > error = mprotect_fixup(vma, &prev, nstart, tmp, newflags); > if (error) > -- > 2.19.1.3.ge56e4f7 > >