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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0110d874-7595-1786-77e3-e2b0daec2327@kernel.dk>
Date:   Mon, 17 Dec 2018 10:29:38 -0700
From:   Jens Axboe <axboe@...nel.dk>
To:     Nathan Chancellor <natechancellor@...il.com>,
        Philipp Reisner <philipp.reisner@...bit.com>,
        Lars Ellenberg <lars.ellenberg@...bit.com>
Cc:     drbd-dev@...ts.linbit.com, linux-block@...r.kernel.org,
        linux-kernel@...r.kernel.org, Arnd Bergmann <arnd@...db.de>,
        Nick Desaulniers <ndesaulniers@...gle.com>
Subject: Re: [PATCH v2] drbd: Avoid Clang warning about pointless switch
 statment

On 12/17/18 10:24 AM, Nathan Chancellor wrote:
> On Thu, Oct 04, 2018 at 01:09:13PM -0700, Nathan Chancellor wrote:
>> There are several warnings from Clang about no case statement matching
>> the constant 0:
>>
>> In file included from drivers/block/drbd/drbd_receiver.c:48:
>> In file included from drivers/block/drbd/drbd_int.h:48:
>> In file included from ./include/linux/drbd_genl_api.h:54:
>> In file included from ./include/linux/genl_magic_struct.h:236:
>> ./include/linux/drbd_genl.h:321:1: warning: no case matching constant
>> switch condition '0'
>> GENL_struct(DRBD_NLA_HELPER, 24, drbd_helper_info,
>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> ./include/linux/genl_magic_struct.h:220:10: note: expanded from macro
>> 'GENL_struct'
>>         switch (0) {
>>                 ^
>>
>> Silence this warning by adding a 'case 0:' statement. Additionally,
>> adjust the alignment of the statements in the ct_assert_unique macro to
>> avoid a checkpatch warning.
>>
>> This solution was originally sent by Arnd Bergmann with a default case
>> statement: https://lore.kernel.org/patchwork/patch/756723/
>>
>> Link: https://github.com/ClangBuiltLinux/linux/issues/43
>> Suggested-by: Lars Ellenberg <lars.ellenberg@...bit.com>
>> Signed-off-by: Nathan Chancellor <natechancellor@...il.com>
>> ---
>>
>> Since this is not the same as Arnd's patch, I took authorship for it
>> while leaving a link to the original patch in the commit message. If
>> this is not how it should have been done, please let me know.
>>
>>  include/linux/genl_magic_struct.h | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/include/linux/genl_magic_struct.h b/include/linux/genl_magic_struct.h
>> index 5972e4969197..eeae59d3ceb7 100644
>> --- a/include/linux/genl_magic_struct.h
>> +++ b/include/linux/genl_magic_struct.h
>> @@ -191,6 +191,7 @@ static inline void ct_assert_unique_operations(void)
>>  {
>>  	switch (0) {
>>  #include GENL_MAGIC_INCLUDE_FILE
>> +	case 0:
>>  		;
>>  	}
>>  }
>> @@ -209,6 +210,7 @@ static inline void ct_assert_unique_top_level_attributes(void)
>>  {
>>  	switch (0) {
>>  #include GENL_MAGIC_INCLUDE_FILE
>> +	case 0:
>>  		;
>>  	}
>>  }
>> @@ -218,7 +220,8 @@ static inline void ct_assert_unique_top_level_attributes(void)
>>  static inline void ct_assert_unique_ ## s_name ## _attributes(void)	\
>>  {									\
>>  	switch (0) {							\
>> -		s_fields						\
>> +	s_fields							\
>> +	case 0:								\
>>  			;						\
>>  	}								\
>>  }
>> -- 
>> 2.19.0
>>
> 
> Hi Lars and Philipp,
> 
> Could you please make sure that this patch and the other one I sent make
> it into 4.21/5.0? I am not sure when you were planning on sending the
> pull request to Jens that you mentioned in the other thread but I've
> noticed most maintainers typically send their requests for the impending
> merge window around -rc7 or so and I wanted to make sure it was on your
> radar.

It needs to get here now, but drbd hasn't really sent anything in for
about a year, so I'm starting to doubt how maintained it is at this
point.

-- 
Jens Axboe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ