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] [day] [month] [year] [list]
Date:	Mon, 19 Dec 2011 14:03:38 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Alexey Dobriyan <adobriyan@...il.com>
Cc:	Al Viro <viro@...IV.linux.org.uk>,
	Eric Dumazet <eric.dumazet@...il.com>,
	Jesper Juhl <jj@...osbits.net>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.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 04:18:28 +0300
Alexey Dobriyan <adobriyan@...il.com> wrote:

> On Sun, Dec 18, 2011 at 12:34:19AM +0000, Al Viro wrote:
> > On Sun, Dec 18, 2011 at 01:18:55AM +0100, Eric Dumazet wrote:
> > > Thats should be fixed in the reverse way :
> > > 
> > > #define flush_tlb_fix_spurious_fault(vma, address) do { } while (0)
> > 
> > There's a better way to do that -
> > #define f(a) do { } while(0)
> > does not work as a function returning void -
> > 	f(1), g();
> > won't work.  OTOH
> > #define f(a) ((void)0)
> > works just fine.
> 
> Two words: static inline.

Amen.  How often must we teach ourselves this lesson?


It gets a bit messy because of:

#ifndef flush_tlb_fix_spurious_fault
#define flush_tlb_fix_spurious_fault(vma, address) flush_tlb_page(vma, address)
#endif

But that can be handled with

static inline void flush_tlb_fix_spurious_fault(...)
{
	...
}
#define flush_tlb_fix_spurious_fault flush_tlb_fix_spurious_fault

and

#ifndef flush_tlb_fix_spurious_fault
static inline void flush_tlb_fix_spurious_fault(...)
{
}
#define flush_tlb_fix_spurious_fault flush_tlb_fix_spurious_fault
#endif
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ