Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4077089ybi; Mon, 15 Jul 2019 03:30:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqwwMUi1brgbuf9j3Lgkhuapc37Djd+wbgthEsBoiNgHP6q+3McME07Nrenc+YceuqtSSokl X-Received: by 2002:a17:90a:d814:: with SMTP id a20mr28597051pjv.48.1563186640463; Mon, 15 Jul 2019 03:30:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563186640; cv=none; d=google.com; s=arc-20160816; b=oKpEzVetQpBeaamPrADJKT4lTSVEiH786qs0tGCdyspSrZ9cp6qNIx6eR84GlZJNAN KAblOkSdlF1R36sK5GyP0RfZ32ibDK/5fU2XxySS38EXtwaBUbb0gq1a672SS/6cQnaZ ZtcbrKF0mM127oOXVYa7V2YGoXd3UWUiZd8vvCuVYQhHkGr2mqhCYTq7yGeZ9FBIKzWR 4DDSvYzSw5nIiPKwyHS+nmwhChxoyHZWWOEh+UoVI62wpnjN4iYgbpZF933WV4bymZmq 7B+atcHF0KqApnxI1cBITCO4qMH+j2r5L+qrZxbMOznn2M/GkwdAM7EQ867pFSTgABna 2BRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject; bh=UBOd3UBDUjX/oOFJq3sQP1/l2QPXkGl25Z4fGzjO8k8=; b=nqhE92hPmbbeQloVpi2SVR6ap3f7KqcAv9j2TfqHy9WCzytLT5bBGJl22ykER31X+s KFaU5OIQB9HzqNSNm9ZWGWY0BqVe85ilbW8NM8rNKiXOGOwyj+hDdh2tHyruRk1gf6/H BLw9mlwSySjJ1niSyWhLA4WzKyZqber/5Fb1fGTxr9D3QMHi8oTDeBOzwstl7Do2cswE NuhpyIbSqs5JGOVmxEQJlvjC6B2yA+52EIW8WJx7G+VrVL0bGZ5pwyXelRQMsTVAhQ86 FMAMl6e/U3jElGuZgxmL6zNuzLxiwprfZqa1Uh85ACEOe8OONGbF1Cl6HqOxSZOeWMMg CGkg== 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=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c11si15676824pgk.383.2019.07.15.03.30.24; Mon, 15 Jul 2019 03:30:40 -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=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729711AbfGOKaA (ORCPT + 99 others); Mon, 15 Jul 2019 06:30:00 -0400 Received: from relay.sw.ru ([185.231.240.75]:56018 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729428AbfGOKaA (ORCPT ); Mon, 15 Jul 2019 06:30:00 -0400 Received: from [172.16.24.21] by relay.sw.ru with esmtp (Exim 4.92) (envelope-from ) id 1hmyF1-0000zw-A2; Mon, 15 Jul 2019 13:29:55 +0300 Subject: Re: [PATCH] generic arch_futex_atomic_op_inuser() cleanup To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Arnd Bergmann References: <7b963f9a-21b1-4c6d-3ece-556d018508b4@virtuozzo.com> From: Vasily Averin Message-ID: <3d9eef14-4059-0f8a-e76f-a8a09d730913@virtuozzo.com> Date: Mon, 15 Jul 2019 13:29:45 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <7b963f9a-21b1-4c6d-3ece-556d018508b4@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Looks like this code is dead and therefore looks strange. I've found it during manual code review and decided to send patch to pay your attention to this problem. Probably it's better to remove this code at all? On 7/15/19 1:27 PM, Vasily Averin wrote: > Access to 'op' variable does not require pagefault_disable(), > 'ret' variable should be initialized before using, > 'oldval' variable can be replaced by constant. > > Signed-off-by: Vasily Averin > --- > include/asm-generic/futex.h | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/include/asm-generic/futex.h b/include/asm-generic/futex.h > index 8666fe7f35d7..e9a9655d786d 100644 > --- a/include/asm-generic/futex.h > +++ b/include/asm-generic/futex.h > @@ -118,9 +118,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, > static inline int > arch_futex_atomic_op_inuser(int op, u32 oparg, int *oval, u32 __user *uaddr) > { > - int oldval = 0, ret; > - > - pagefault_disable(); > + int ret = 0; > > switch (op) { > case FUTEX_OP_SET: > @@ -132,10 +130,8 @@ arch_futex_atomic_op_inuser(int op, u32 oparg, int *oval, u32 __user *uaddr) > ret = -ENOSYS; > } > > - pagefault_enable(); > - > if (!ret) > - *oval = oldval; > + *oval = 0; > > return ret; > } >