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]
Date:	Tue, 28 Feb 2012 21:06:00 +0100
From:	Sam Ravnborg <sam@...nborg.org>
To:	Paul Gortmaker <paul.gortmaker@...driver.com>
Cc:	Fabio Estevam <fabio.estevam@...escale.com>,
	linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
	linux@....linux.org.uk
Subject: Re: [PATCH] kernel.h: Include <linux/bug.h> to avoid build breakage
	with ARRAY_SIZE()

On Tue, Feb 28, 2012 at 11:43:36AM -0500, Paul Gortmaker wrote:
> On 12-02-28 10:51 AM, Sam Ravnborg wrote:
> > On Tue, Feb 28, 2012 at 10:41:39AM -0300, Fabio Estevam wrote:
> >> Building imx_v6_v7_defconfig generated the following build error:
> >>
> >> arch/arm/mach-imx/cpu_op-mx51.c: In function 'mx51_get_cpu_op':
> >> arch/arm/mach-imx/cpu_op-mx51.c:27: error: implicit declaration of function 'BUILD_BUG_ON_ZERO'
> >>
> >> commit 6f863554 (kernel.h: doesn't explicitly use bug.h, so don't include it.)
> >> has removed asm/debug.h from linux/kernel.h.
> >>
> >> Quoting Russell King (http://www.spinics.net/lists/arm-kernel/msg161916.html)
> >>
> >> "linux/kernel.h _does_ use bug stuff - in ARRAY_SIZE().
> >>
> >> ARRAY_SIZE() uses __must_be_array(), which is defined in linux/compiler-gcc.h,
> >> which is obtained via linux/compiler.h and linux/linkage.h.
> >>
> >> linux/compiler-gcc.h defines __must_be_array() to be:
> >> #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
> > 
> > In which case linux/compiler-gcc.h uses bug.h - so this is where you
> > should add the include.
> > Not in kernel.h that just happens to use __must_be_array()
> > We do not want to add "#include bug.h" to all header files
> > that happens to use __must_be_array.
> 
> The approach I was taking was to consider something "used" if it was
> actually in a static inline[1]. So in that sense, the kernel.h does
> not "use" ARRAY_SIZE, but only defines it.  This seems to be what has
> been done in the past, and folks have even converted trivial static
> inline functions to macros just to use this concept of "used" to
> help avoid tangling includes any further than they currently are.

We have a macro which uses a macro which uses a macro from bug.h.
Should we include bug.h with the first or the second macro?

I guess in this case it does not matter much.

	Sam
--
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