lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1112180125250.21784@swampdragon.chaosbits.net>
Date:	Sun, 18 Dec 2011 01:26:37 +0100 (CET)
From:	Jesper Juhl <jj@...osbits.net>
To:	Eric Dumazet <eric.dumazet@...il.com>
cc:	linux-mm@...ck.org, linux-kernel@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	Michel Lespinasse <walken@...gle.com>,
	Hugh Dickins <hughd@...gle.com>,
	Andrea Arcangeli <aarcange@...hat.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
Subject: Re: [PATCH] Put braces around potentially empty 'if' body in
 handle_pte_fault()

On Sun, 18 Dec 2011, Eric Dumazet wrote:

> Le dimanche 18 décembre 2011 à 01:03 +0100, Jesper Juhl a écrit :
> > If one builds the kernel with -Wempty-body one gets this warning:
> > 
> >   mm/memory.c:3432:46: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
> > 
> > due to the fact that 'flush_tlb_fix_spurious_fault' is a macro that
> > can sometimes be defined to nothing.
> > 
> > I suggest we heed gcc's advice and put a pair of braces on that if.
> > 
> > Signed-off-by: Jesper Juhl <jj@...osbits.net>
> > ---
> >  mm/memory.c |    3 ++-
> >  1 files changed, 2 insertions(+), 1 deletions(-)
> > 
> > diff --git a/mm/memory.c b/mm/memory.c
> > index 829d437..9cf1b48 100644
> > --- a/mm/memory.c
> > +++ b/mm/memory.c
> > @@ -3428,9 +3428,9 @@ int handle_pte_fault(struct mm_struct *mm,
> >  		 * This still avoids useless tlb flushes for .text page faults
> >  		 * with threads.
> >  		 */
> > -		if (flags & FAULT_FLAG_WRITE)
> > +		if (flags & FAULT_FLAG_WRITE) {
> >  			flush_tlb_fix_spurious_fault(vma, address);
> > +		}
> >  	}
> >  unlock:
> >  	pte_unmap_unlock(pte, ptl);
> > -- 
> > 1.7.8
> > 
> 
> Thats should be fixed in the reverse way :
> 
> #define flush_tlb_fix_spurious_fault(vma, address) do { } while (0)
> 

I did consider that, bot opted for the other solution since there was only 
one user. But, on second thought, you are right, I should just have made 
the macro safe so that future uses also won't have problems. Will send a 
new patch in a minute.

-- 
Jesper Juhl <jj@...osbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ