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, 14 Aug 2018 18:31:05 +0900
From:   Masahiro Yamada <yamada.masahiro@...ionext.com>
To:     Johannes Berg <johannes@...solutions.net>
Cc:     Arnd Bergmann <arnd@...db.de>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Jakub Kicinski <jakub.kicinski@...ronome.com>,
        Andy Shevchenko <andy.shevchenko@...il.com>,
        Al Viro <viro@...iv.linux.org.uk>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] bitfield: avoid gcc-8 -Wint-in-bool-context warning

2018-08-14 16:56 GMT+09:00 Johannes Berg <johannes@...solutions.net>:
> On Tue, 2018-08-14 at 08:57 +0900, Masahiro Yamada wrote:
>> 2018-08-14 7:09 GMT+09:00 Arnd Bergmann <arnd@...db.de>:
>> > Passing an enum into FIELD_GET() produces a long but harmless warning on
>> > newer compilers:
>> >
>> >                  from include/linux/linkage.h:7,
>> >                  from include/linux/kernel.h:7,
>> >                  from include/linux/skbuff.h:17,
>> >                  from include/linux/if_ether.h:23,
>> >                  from include/linux/etherdevice.h:25,
>> >                  from drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c:63:
>> > drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c: In function 'iwl_mvm_rx_mpdu_mq':
>> > include/linux/bitfield.h:56:20: error: enum constant in boolean context [-Werror=int-in-bool-context]
>> >    BUILD_BUG_ON_MSG(!(_mask), _pfx "mask is zero"); \
>> >                     ^
>> > ...
>> > include/linux/bitfield.h:103:3: note: in expansion of macro '__BF_FIELD_CHECK'
>> >    __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
>> >    ^~~~~~~~~~~~~~~~
>> > drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c:1025:21: note: in expansion of macro 'FIELD_GET'
>> >     le16_encode_bits(FIELD_GET(IWL_RX_HE_PHY_SIBG_SYM_OR_USER_NUM_MASK,
>>
>>
>> How about fixing the root cause
>> in drivers/net/wireless/intel/iwlwifi/fw/api/rx.h ?
>>
>>
>> #define IWL_RX_HE_PHY_SIBG_SYM_OR_USER_NUM_MASK   0x1e00000000ULL
>>
>>
>> enum iwl_rx_he_phy looks really strange.
>
> Why? I don't think this is a problem, the enum is used here to get
> constants so that we can also have documentation for them. That's a
> common and accepted technique.


I do not see any variable declared as 'enum iwl_rx_he_phy'.

This is not legitimate usage of enum.


The mask macros must have a particular value,
hence

#define IWL_RX_HE_PHY_SIBG_SYM_OR_USER_NUM_MASK   0x1e00000000ULL

is a straightforward way.


>
>> Passing enum to FIELD_GET is odd,
>> so I prefer keeping this warned.
>
> What for?


If you pass enum to FIELD_GET,
it is very like to be _abuse_ of enum.




> I think we should go with Arend's patch, and I hope Andrew will pick it
> up, but otherwise I guess we can also put it through any other tree.
>
> johannes



-- 
Best Regards
Masahiro Yamada

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ