linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] build_bug.h: remove negative-array fallback for BUILD_BUG_ON()
@ 2018-11-16  6:19 Masahiro Yamada
  2018-11-16  6:19 ` [PATCH 2/2] build_bug.h: remove all dummy BUILD_BUG_ON stubs for sparse Masahiro Yamada
  2018-11-16 19:01 ` [PATCH 1/2] build_bug.h: remove negative-array fallback for BUILD_BUG_ON() Kees Cook
  0 siblings, 2 replies; 6+ messages in thread
From: Masahiro Yamada @ 2018-11-16  6:19 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Linus Torvalds, Arnd Bergmann, Kees Cook, Nick Desaulniers,
	Miguel Ojeda, Masahiro Yamada, linux-kernel

The kernel can only be compiled with an optimization option (-O2, -Os,
or the currently proposed -Og). Hence, __OPTIMIZE__ is always defined
in the kernel source.

A fallback for -O0 case is just hypothetical and pointless. Moreover,
commit 0bb95f80a38f ("Makefile: Globally enable VLA warning") enabled
-Wvla warning. The use of variable length arrays is banned.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 include/linux/build_bug.h | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/include/linux/build_bug.h b/include/linux/build_bug.h
index 43d1fd5..d415c64 100644
--- a/include/linux/build_bug.h
+++ b/include/linux/build_bug.h
@@ -51,23 +51,9 @@
  * If you have some code which relies on certain constants being equal, or
  * some other compile-time-evaluated condition, you should use BUILD_BUG_ON to
  * detect if someone changes it.
- *
- * The implementation uses gcc's reluctance to create a negative array, but gcc
- * (as of 4.4) only emits that error for obvious cases (e.g. not arguments to
- * inline functions).  Luckily, in 4.3 they added the "error" function
- * attribute just for this type of case.  Thus, we use a negative sized array
- * (should always create an error on gcc versions older than 4.4) and then call
- * an undefined function with the error attribute (should always create an
- * error on gcc 4.3 and later).  If for some reason, neither creates a
- * compile-time error, we'll still have a link-time error, which is harder to
- * track down.
  */
-#ifndef __OPTIMIZE__
-#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
-#else
 #define BUILD_BUG_ON(condition) \
 	BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
-#endif
 
 /**
  * BUILD_BUG - break compile if used.
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] build_bug.h: remove all dummy BUILD_BUG_ON stubs for sparse
  2018-11-16  6:19 [PATCH 1/2] build_bug.h: remove negative-array fallback for BUILD_BUG_ON() Masahiro Yamada
@ 2018-11-16  6:19 ` Masahiro Yamada
  2018-11-17 10:53   ` kbuild test robot
  2018-11-16 19:01 ` [PATCH 1/2] build_bug.h: remove negative-array fallback for BUILD_BUG_ON() Kees Cook
  1 sibling, 1 reply; 6+ messages in thread
From: Masahiro Yamada @ 2018-11-16  6:19 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Linus Torvalds, Arnd Bergmann, Kees Cook, Nick Desaulniers,
	Miguel Ojeda, Masahiro Yamada, linux-kernel

The introduction of these dummy BUILD_BUG_ON stubs dates back to
commit 903c0c7cdc21 ("sparse: define dummy BUILD_BUG_ON definition
for sparse"). At that time, BUILD_BUG_ON() was implemented with the
negative array trick, which Sparse complains about even if the
condition can be optimized and evaluated to 0 at compile-time.

With the previous commit, the leftover negative array trick is gone.
Sparse is happy with the current BUILD_BUG_ON(), which is implemented
by using the 'error' attribute.

There might be a little room for argument about BUILD_BUG_ON_ZERO().
Sparse reports 'invalid bitfield width, -1' for non-zero value,
and 'bad integer constant expression' for non-constant value.
This is the same criteria as GCC uses. So, if those Sparse errors
occurred, they would cause errors for GCC as well. (Hence, such
errors would have been detected by the normal compile test process.)

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 include/linux/build_bug.h | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/include/linux/build_bug.h b/include/linux/build_bug.h
index d415c64..b0828f7 100644
--- a/include/linux/build_bug.h
+++ b/include/linux/build_bug.h
@@ -4,16 +4,6 @@
 
 #include <linux/compiler.h>
 
-#ifdef __CHECKER__
-#define __BUILD_BUG_ON_NOT_POWER_OF_2(n) (0)
-#define BUILD_BUG_ON_NOT_POWER_OF_2(n) (0)
-#define BUILD_BUG_ON_ZERO(e) (0)
-#define BUILD_BUG_ON_INVALID(e) (0)
-#define BUILD_BUG_ON_MSG(cond, msg) (0)
-#define BUILD_BUG_ON(condition) (0)
-#define BUILD_BUG() (0)
-#else /* __CHECKER__ */
-
 /* Force a compilation error if a constant expression is not a power of 2 */
 #define __BUILD_BUG_ON_NOT_POWER_OF_2(n)	\
 	BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
@@ -64,6 +54,5 @@
  */
 #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
 
-#endif	/* __CHECKER__ */
 
 #endif	/* _LINUX_BUILD_BUG_H */
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] build_bug.h: remove negative-array fallback for BUILD_BUG_ON()
  2018-11-16  6:19 [PATCH 1/2] build_bug.h: remove negative-array fallback for BUILD_BUG_ON() Masahiro Yamada
  2018-11-16  6:19 ` [PATCH 2/2] build_bug.h: remove all dummy BUILD_BUG_ON stubs for sparse Masahiro Yamada
@ 2018-11-16 19:01 ` Kees Cook
  2018-11-24  8:14   ` Miguel Ojeda
  1 sibling, 1 reply; 6+ messages in thread
From: Kees Cook @ 2018-11-16 19:01 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Andrew Morton, Linus Torvalds, Arnd Bergmann, Nick Desaulniers,
	Miguel Ojeda, LKML

On Fri, Nov 16, 2018 at 12:19 AM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> The kernel can only be compiled with an optimization option (-O2, -Os,
> or the currently proposed -Og). Hence, __OPTIMIZE__ is always defined
> in the kernel source.
>
> A fallback for -O0 case is just hypothetical and pointless. Moreover,
> commit 0bb95f80a38f ("Makefile: Globally enable VLA warning") enabled
> -Wvla warning. The use of variable length arrays is banned.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Acked-by: Kees Cook <keescook@chromium.org>

-Kees

> ---
>
>  include/linux/build_bug.h | 14 --------------
>  1 file changed, 14 deletions(-)
>
> diff --git a/include/linux/build_bug.h b/include/linux/build_bug.h
> index 43d1fd5..d415c64 100644
> --- a/include/linux/build_bug.h
> +++ b/include/linux/build_bug.h
> @@ -51,23 +51,9 @@
>   * If you have some code which relies on certain constants being equal, or
>   * some other compile-time-evaluated condition, you should use BUILD_BUG_ON to
>   * detect if someone changes it.
> - *
> - * The implementation uses gcc's reluctance to create a negative array, but gcc
> - * (as of 4.4) only emits that error for obvious cases (e.g. not arguments to
> - * inline functions).  Luckily, in 4.3 they added the "error" function
> - * attribute just for this type of case.  Thus, we use a negative sized array
> - * (should always create an error on gcc versions older than 4.4) and then call
> - * an undefined function with the error attribute (should always create an
> - * error on gcc 4.3 and later).  If for some reason, neither creates a
> - * compile-time error, we'll still have a link-time error, which is harder to
> - * track down.
>   */
> -#ifndef __OPTIMIZE__
> -#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
> -#else
>  #define BUILD_BUG_ON(condition) \
>         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
> -#endif
>
>  /**
>   * BUILD_BUG - break compile if used.
> --
> 2.7.4
>



-- 
Kees Cook

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] build_bug.h: remove all dummy BUILD_BUG_ON stubs for sparse
  2018-11-16  6:19 ` [PATCH 2/2] build_bug.h: remove all dummy BUILD_BUG_ON stubs for sparse Masahiro Yamada
@ 2018-11-17 10:53   ` kbuild test robot
  2018-11-19 10:37     ` Masahiro Yamada
  0 siblings, 1 reply; 6+ messages in thread
From: kbuild test robot @ 2018-11-17 10:53 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: kbuild-all, Andrew Morton, Linus Torvalds, Arnd Bergmann,
	Kees Cook, Nick Desaulniers, Miguel Ojeda, Masahiro Yamada,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 14537 bytes --]

Hi Masahiro,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.20-rc2 next-20181116]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Masahiro-Yamada/build_bug-h-remove-negative-array-fallback-for-BUILD_BUG_ON/20181116-190414
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/crypto/chelsio/chcr_algo.c:241:29: warning: cast to restricted __be32
   drivers/crypto/chelsio/chcr_algo.c:241:29: warning: cast to restricted __be32
   drivers/crypto/chelsio/chcr_algo.c:241:29: warning: cast to restricted __be32
   drivers/crypto/chelsio/chcr_algo.c:241:29: warning: cast to restricted __be32
   drivers/crypto/chelsio/chcr_algo.c:241:29: warning: cast to restricted __be32
   drivers/crypto/chelsio/chcr_algo.c:241:29: warning: cast to restricted __be32
   drivers/crypto/chelsio/chcr_algo.c:260:39: warning: incorrect type in assignment (different base types)
   drivers/crypto/chelsio/chcr_algo.c:260:39:    expected unsigned int [unsigned] [usertype] <noident>
   drivers/crypto/chelsio/chcr_algo.c:260:39:    got restricted __be32 [usertype] <noident>
   drivers/crypto/chelsio/chcr_algo.c:2301:21: warning: restricted __be32 degrades to integer
   drivers/crypto/chelsio/chcr_algo.c:2301:21: warning: cast to restricted __be32
   drivers/crypto/chelsio/chcr_algo.c:2301:21: warning: restricted __be32 degrades to integer
   drivers/crypto/chelsio/chcr_algo.c:2301:21: warning: cast to restricted __be32
   drivers/crypto/chelsio/chcr_algo.c:2301:21: warning: restricted __be32 degrades to integer
   drivers/crypto/chelsio/chcr_algo.c:2301:21: warning: cast to restricted __be32
   drivers/crypto/chelsio/chcr_algo.c:2301:21: warning: restricted __be32 degrades to integer
   drivers/crypto/chelsio/chcr_algo.c:2301:21: warning: cast to restricted __be32
   drivers/crypto/chelsio/chcr_algo.c:2301:21: warning: restricted __be32 degrades to integer
   drivers/crypto/chelsio/chcr_algo.c:2301:21: warning: cast to restricted __be32
   drivers/crypto/chelsio/chcr_algo.c:2301:21: warning: restricted __be32 degrades to integer
   drivers/crypto/chelsio/chcr_algo.c:2301:21: warning: cast to restricted __be32
   drivers/crypto/chelsio/chcr_algo.c:2747:65: warning: incorrect type in assignment (different base types)
   drivers/crypto/chelsio/chcr_algo.c:2747:65:    expected unsigned short [unsigned] [short] <noident>
   drivers/crypto/chelsio/chcr_algo.c:2747:65:    got restricted __be16 [usertype] <noident>
   drivers/crypto/chelsio/chcr_algo.c:3014:46: warning: incorrect type in assignment (different base types)
   drivers/crypto/chelsio/chcr_algo.c:3014:46:    expected unsigned int [unsigned] <noident>
   drivers/crypto/chelsio/chcr_algo.c:3014:46:    got restricted __be32 [usertype] <noident>
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
--
   drivers/crypto/mediatek/mtk-sha.c:251:17: warning: incorrect type in assignment (different base types)
   drivers/crypto/mediatek/mtk-sha.c:251:17:    expected unsigned long long [unsigned] [long] [long long] <noident>
   drivers/crypto/mediatek/mtk-sha.c:251:17:    got restricted __be64 [usertype] <noident>
   drivers/crypto/mediatek/mtk-sha.c:252:17: warning: incorrect type in assignment (different base types)
   drivers/crypto/mediatek/mtk-sha.c:252:17:    expected unsigned long long [unsigned] [long] [long long] <noident>
   drivers/crypto/mediatek/mtk-sha.c:252:17:    got restricted __be64 [usertype] <noident>
   include/linux/slab.h:332:43: warning: dubious: x & !y
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
--
   include/linux/slab.h:332:43: warning: dubious: x & !y
   include/linux/slab.h:332:43: warning: dubious: x & !y
   include/linux/slab.h:332:43: warning: dubious: x & !y
   include/linux/slab.h:332:43: warning: dubious: x & !y
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
--
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
--
   include/linux/slab.h:332:43: warning: dubious: x & !y
   include/linux/slab.h:332:43: warning: dubious: x & !y
   include/linux/slab.h:332:43: warning: dubious: x & !y
   include/linux/slab.h:332:43: warning: dubious: x & !y
   include/linux/slab.h:332:43: warning: dubious: x & !y
   include/linux/slab.h:332:43: warning: dubious: x & !y
   include/linux/slab.h:332:43: warning: dubious: x & !y
   include/linux/slab.h:332:43: warning: dubious: x & !y
   include/linux/slab.h:332:43: warning: dubious: x & !y
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
--
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
--
   include/linux/slab.h:332:43: warning: dubious: x & !y
   include/linux/slab.h:332:43: warning: dubious: x & !y
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
--
>> sound/hda/ext/hdac_ext_bus.c:203:36: warning: unknown expression (4 0)
>> sound/hda/ext/hdac_ext_bus.c:203:36: warning: unknown expression (4 0)
>> sound/hda/ext/hdac_ext_bus.c:203:36: warning: unknown expression (4 0)
>> sound/hda/ext/hdac_ext_bus.c:203:36: warning: unknown expression (4 0)
>> sound/hda/ext/hdac_ext_bus.c:203:36: warning: unknown expression (4 0)
>> sound/hda/ext/hdac_ext_bus.c:203:36: warning: unknown expression (4 0)
>> sound/hda/ext/hdac_ext_bus.c:203:36: warning: unknown expression (4 0)
>> sound/hda/ext/hdac_ext_bus.c:203:36: warning: unknown expression (4 0)
>> sound/hda/ext/hdac_ext_bus.c:203:36: warning: unknown expression (4 0)
>> sound/hda/ext/hdac_ext_bus.c:203:36: warning: unknown expression (4 0)
>> sound/hda/ext/hdac_ext_bus.c:203:36: warning: unknown expression (4 0)
>> sound/hda/ext/hdac_ext_bus.c:203:36: warning: unknown expression (4 0)
--
   include/linux/slab.h:332:43: warning: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_ah.c:72:24: warning: incorrect type in assignment (different base types)
   drivers/infiniband/hw/hns/hns_roce_ah.c:72:24:    expected restricted __le32 [usertype] port_pd
   drivers/infiniband/hw/hns/hns_roce_ah.c:72:24:    got restricted __be32 [usertype] <noident>
>> drivers/infiniband/hw/hns/hns_roce_device.h:869:16: warning: unknown expression (4 0)
>> drivers/infiniband/hw/hns/hns_roce_device.h:869:16: warning: unknown expression (4 0)
>> drivers/infiniband/hw/hns/hns_roce_device.h:869:16: warning: unknown expression (4 0)
>> drivers/infiniband/hw/hns/hns_roce_device.h:869:16: warning: unknown expression (4 0)
>> drivers/infiniband/hw/hns/hns_roce_device.h:869:16: warning: unknown expression (4 0)
>> drivers/infiniband/hw/hns/hns_roce_device.h:869:16: warning: unknown expression (4 0)
>> drivers/infiniband/hw/hns/hns_roce_device.h:869:16: warning: unknown expression (4 0)
>> drivers/infiniband/hw/hns/hns_roce_device.h:869:16: warning: unknown expression (4 0)
>> drivers/infiniband/hw/hns/hns_roce_device.h:869:16: warning: unknown expression (4 0)
>> drivers/infiniband/hw/hns/hns_roce_device.h:869:16: warning: unknown expression (4 0)
>> drivers/infiniband/hw/hns/hns_roce_device.h:869:16: warning: unknown expression (4 0)
>> drivers/infiniband/hw/hns/hns_roce_device.h:869:16: warning: unknown expression (4 0)
>> drivers/infiniband/hw/hns/hns_roce_device.h:869:16: warning: unknown expression (4 0)
>> drivers/infiniband/hw/hns/hns_roce_device.h:869:16: warning: unknown expression (4 0)
>> drivers/infiniband/hw/hns/hns_roce_device.h:869:16: warning: unknown expression (4 0)
>> drivers/infiniband/hw/hns/hns_roce_device.h:869:16: warning: unknown expression (4 0)
>> drivers/infiniband/hw/hns/hns_roce_device.h:869:16: warning: unknown expression (4 0)
>> drivers/infiniband/hw/hns/hns_roce_device.h:869:16: warning: unknown expression (4 0)
>> drivers/infiniband/hw/hns/hns_roce_device.h:869:16: warning: unknown expression (4 0)
>> drivers/infiniband/hw/hns/hns_roce_device.h:869:16: warning: unknown expression (4 0)
--
   include/linux/slab.h:332:43: warning: dubious: x & !y
   include/linux/slab.h:332:43: warning: dubious: x & !y
   include/linux/slab.h:332:43: warning: dubious: x & !y
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
--
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
>> include/crypto/hash.h:767:16: warning: unknown expression (4 0)
..

vim +767 include/crypto/hash.h

974959863 Herbert Xu 2009-02-03  764  
7b5a080b3 Herbert Xu 2008-08-31  765  static inline struct shash_alg *__crypto_shash_alg(struct crypto_alg *alg)
7b5a080b3 Herbert Xu 2008-08-31  766  {
7b5a080b3 Herbert Xu 2008-08-31 @767  	return container_of(alg, struct shash_alg, base);
7b5a080b3 Herbert Xu 2008-08-31  768  }
7b5a080b3 Herbert Xu 2008-08-31  769  

:::::: The code at line 767 was first introduced by commit
:::::: 7b5a080b3c46f0cac71c0d0262634c6517d4ee4f crypto: hash - Add shash interface

:::::: TO: Herbert Xu <herbert@gondor.apana.org.au>
:::::: CC: Herbert Xu <herbert@gondor.apana.org.au>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 66620 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] build_bug.h: remove all dummy BUILD_BUG_ON stubs for sparse
  2018-11-17 10:53   ` kbuild test robot
@ 2018-11-19 10:37     ` Masahiro Yamada
  0 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2018-11-19 10:37 UTC (permalink / raw)
  To: kbuild test robot
  Cc: kbuild-all, Andrew Morton, Linus Torvalds, Arnd Bergmann,
	Kees Cook, Nick Desaulniers, Miguel Ojeda,
	Linux Kernel Mailing List

On Sat, Nov 17, 2018 at 7:56 PM kbuild test robot <lkp@intel.com> wrote:
>
> Hi Masahiro,
>
> I love your patch! Perhaps something to improve:
>
> [auto build test WARNING on linus/master]
> [also build test WARNING on v4.20-rc2 next-20181116]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url:    https://github.com/0day-ci/linux/commits/Masahiro-Yamada/build_bug-h-remove-negative-array-fallback-for-BUILD_BUG_ON/20181116-190414
> config: x86_64-allmodconfig (attached as .config)
> compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
> reproduce:
>         # save the attached .config to linux build tree
>         make ARCH=x86_64


OK, I was digging into this Sparse warning.

I suspect this is a bug of Sparse.

I submitted this to disable __builtin_types_compatible_p() for Sparse.

https://lore.kernel.org/patchwork/patch/1013734/





-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] build_bug.h: remove negative-array fallback for BUILD_BUG_ON()
  2018-11-16 19:01 ` [PATCH 1/2] build_bug.h: remove negative-array fallback for BUILD_BUG_ON() Kees Cook
@ 2018-11-24  8:14   ` Miguel Ojeda
  0 siblings, 0 replies; 6+ messages in thread
From: Miguel Ojeda @ 2018-11-24  8:14 UTC (permalink / raw)
  To: Kees Cook
  Cc: Masahiro Yamada, Andrew Morton, Linus Torvalds, Arnd Bergmann,
	Nick Desaulniers, linux-kernel

On Fri, Nov 16, 2018 at 8:01 PM Kees Cook <keescook@chromium.org> wrote:
>
> On Fri, Nov 16, 2018 at 12:19 AM, Masahiro Yamada
> <yamada.masahiro@socionext.com> wrote:
> > The kernel can only be compiled with an optimization option (-O2, -Os,
> > or the currently proposed -Og). Hence, __OPTIMIZE__ is always defined
> > in the kernel source.
> >
> > A fallback for -O0 case is just hypothetical and pointless. Moreover,
> > commit 0bb95f80a38f ("Makefile: Globally enable VLA warning") enabled
> > -Wvla warning. The use of variable length arrays is banned.
> >
> > Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>
> Acked-by: Kees Cook <keescook@chromium.org>

Acked-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-11-24  8:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-16  6:19 [PATCH 1/2] build_bug.h: remove negative-array fallback for BUILD_BUG_ON() Masahiro Yamada
2018-11-16  6:19 ` [PATCH 2/2] build_bug.h: remove all dummy BUILD_BUG_ON stubs for sparse Masahiro Yamada
2018-11-17 10:53   ` kbuild test robot
2018-11-19 10:37     ` Masahiro Yamada
2018-11-16 19:01 ` [PATCH 1/2] build_bug.h: remove negative-array fallback for BUILD_BUG_ON() Kees Cook
2018-11-24  8:14   ` Miguel Ojeda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).