From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932404Ab0E0PiB (ORCPT ); Thu, 27 May 2010 11:38:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52868 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932270Ab0E0Ph6 (ORCPT ); Thu, 27 May 2010 11:37:58 -0400 Date: Thu, 27 May 2010 17:36:39 +0200 From: Oleg Nesterov To: Roland McGrath , Andrew Morton Cc: Andi Kleen , "H. Peter Anvin" , Linus Torvalds , Richard Henderson , wezhang@redhat.com, linux-kernel@vger.kernel.org, Michael Kerrisk , William Cohen Subject: [PATCH 3/3] __set_personality: no need to check the old ->exec_domain Message-ID: <20100527153639.GD13858@redhat.com> References: <20100525141720.GA2253@redhat.com> <20100525193348.83F1549A54@magilla.sf.frob.com> <20100526123622.GA26033@redhat.com> <20100526203105.59D7849A56@magilla.sf.frob.com> <20100527153522.GA13858@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100527153522.GA13858@redhat.com> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Cleanup. __set_personality() always changes ->exec_domain/personality, the special case when ->exec_domain remains the same buys nothing but complicates the code. I don't understand why lookup_exec_domain() always succeeds even if the search in ->exec_domains list fails, we use default_exec_domain in this case. Signed-off-by: Oleg Nesterov --- kernel/exec_domain.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) --- 34-rc1/kernel/exec_domain.c~3_CLEANUP_SET_PERSONALITY 2010-05-27 15:54:33.000000000 +0200 +++ 34-rc1/kernel/exec_domain.c 2010-05-27 17:03:29.000000000 +0200 @@ -134,23 +134,14 @@ unregister: return 0; } -int -__set_personality(u_long personality) +int __set_personality(u_long personality) { - struct exec_domain *ep, *oep; - - ep = lookup_exec_domain(personality); - if (ep == current_thread_info()->exec_domain) { - current->personality = personality; - module_put(ep->module); - return 0; - } + struct exec_domain *oep = current_thread_info()->exec_domain; + current_thread_info()->exec_domain = lookup_exec_domain(personality); current->personality = personality; - oep = current_thread_info()->exec_domain; - current_thread_info()->exec_domain = ep; - module_put(oep->module); + return 0; }