linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jesper Juhl <jj@chaosbits.net>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Michel Lespinasse <walken@google.com>,
	Hugh Dickins <hughd@google.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Subject: Re: [PATCH] Put braces around potentially empty 'if' body in handle_pte_fault()
Date: Sun, 18 Dec 2011 01:26:37 +0100 (CET)	[thread overview]
Message-ID: <alpine.LNX.2.00.1112180125250.21784@swampdragon.chaosbits.net> (raw)
In-Reply-To: <1324167535.3323.63.camel@edumazet-laptop>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1690 bytes --]

On Sun, 18 Dec 2011, Eric Dumazet wrote:

> Le dimanche 18 dA(C)cembre 2011 A  01:03 +0100, Jesper Juhl a A(C)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 a??ifa?? 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@chaosbits.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@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

  reply	other threads:[~2011-12-18  0:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-18  0:03 Jesper Juhl
2011-12-18  0:18 ` Eric Dumazet
2011-12-18  0:26   ` Jesper Juhl [this message]
2011-12-18  0:34   ` Al Viro
2011-12-18  1:18     ` Alexey Dobriyan
2011-12-19 22:03       ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.2.00.1112180125250.21784@swampdragon.chaosbits.net \
    --to=jj@chaosbits.net \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=eric.dumazet@gmail.com \
    --cc=hughd@google.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=walken@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox