Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752204AbdCCSYe (ORCPT ); Fri, 3 Mar 2017 13:24:34 -0500 Received: from mx2.suse.de ([195.135.220.15]:54142 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751924AbdCCSXr (ORCPT ); Fri, 3 Mar 2017 13:23:47 -0500 From: Jiri Slaby To: akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 3/3] futex: make the encoded_op decoding readable Date: Fri, 3 Mar 2017 13:27:12 +0100 Message-Id: <20170303122712.13353-3-jslaby@suse.cz> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170303122712.13353-1-jslaby@suse.cz> References: <20170303122712.13353-1-jslaby@suse.cz> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1073 Lines: 31 Decoding of encoded_op is a bit unreadable. It contains shifts to the left and to the right by some constants. Make it clearly visible what part of the bit mask is taken and shift the values only to the right appropriatelly. Signed-off-by: Jiri Slaby --- kernel/futex.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/futex.c b/kernel/futex.c index c09424406560..5834df248f09 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -1459,10 +1459,10 @@ futex_wake(u32 __user *uaddr, unsigned int flags, int nr_wake, u32 bitset) static int futex_atomic_op_inuser(unsigned int encoded_op, u32 __user *uaddr) { - int op = (encoded_op >> 28) & 7; - int cmp = (encoded_op >> 24) & 15; - int oparg = (encoded_op << 8) >> 20; - int cmparg = (encoded_op << 20) >> 20; + int op = (encoded_op & 0x70000000) >> 28; + int cmp = (encoded_op & 0x0f000000) >> 24; + int oparg = (encoded_op & 0x00fff000) >> 12; + int cmparg = encoded_op & 0x00000fff; int oldval, ret; if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) { -- 2.12.0