From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752727AbdLNONP (ORCPT ); Thu, 14 Dec 2017 09:13:15 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:37568 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752638AbdLNONN (ORCPT ); Thu, 14 Dec 2017 09:13:13 -0500 Date: Thu, 14 Dec 2017 15:12:03 +0100 (CET) From: Thomas Gleixner To: Juergen Gross cc: Jan Beulich , mingo@elte.hu, hpa@zytor.com, xen-devel , Boris Ostrovsky , sds@tycho.nsa.gov, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] x86: consider effective protection attributes in W+X check In-Reply-To: Message-ID: References: <5A2FBC570200007800196B3E@prv-mh.provo.novell.com> <5A2FBE0A0200007800196B4F@suse.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 14 Dec 2017, Juergen Gross wrote: > On 12/12/17 11:31, Jan Beulich wrote: > > for (i = 0; i < PTRS_PER_PMD; i++) { > > st->current_address = normalize_addr(P + i * PMD_LEVEL_MULT); > > if (!pmd_none(*start)) { > > + prot = pmd_flags(*start); > > + eff = effective_prot(eff_in, prot); > > if (pmd_large(*start) || !pmd_present(*start)) { > > - prot = pmd_flags(*start); > > - note_page(m, st, __pgprot(prot), 4); > > + note_page(m, st, __pgprot(prot), eff, 4); > > } else if (!kasan_page_table(m, st, pmd_start)) { > > - walk_pte_level(m, st, *start, > > + walk_pte_level(m, st, *start, eff, > > P + i * PMD_LEVEL_MULT); > > } > > You can drop the braces for both cases. Applies to similar > constructs below, too. No. See: https://marc.info/?l=linux-kernel&m=148467980905537 This is the same issue: if (foo) bla(); else blurb(somestuff, morestuff, evenmorestuff, crap); vs. if (foo) { bla(); } else { blurb(somestuff, morestuff, evenmorestuff, crap); } Thanks, tglx