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:   Mon, 13 Sep 2021 12:13:45 -0700
From:   Nathan Chancellor <nathan@...nel.org>
To:     Jason Gunthorpe <jgg@...dia.com>
Cc:     Nick Desaulniers <ndesaulniers@...gle.com>,
        kernel test robot <lkp@...el.com>, llvm@...ts.linux.dev,
        kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        clang-built-linux@...glegroups.com
Subject: Re: drivers/infiniband/hw/qib/qib_sysfs.c:413:1: error: static_assert
 expression is not an integral constant expression

On 9/13/2021 12:02 PM, Jason Gunthorpe wrote:
> On Mon, Sep 13, 2021 at 11:53:25AM -0700, Nathan Chancellor wrote:
>> On Mon, Sep 13, 2021 at 03:38:13PM -0300, Jason Gunthorpe wrote:
>>> On Mon, Sep 13, 2021 at 10:00:02AM -0700, Nick Desaulniers wrote:
>>>
>>>>> This macro would like to know that the passed in member name has a u64
>>>>> type, all the things I've come up with fail on clang - but many work
>>>>> fine on gcc. Frankly I think this case is a clang bug myself..
>>>>
>>>> Perhaps, though this assertion looks a bit like offsetof() to me. I
>>>> wonder if that can help here?
>>>
>>> The assertion would logically like to be this:
>>>
>>>           static_assert(typecheck(((struct qib_port *)0)->N, u64))
>>
>> This works for me with both GCC and clang, if that is acceptable to you?
>> It fails if you change one of the variables to 'u32'.
> 
> Yes, thanks. Can't say I've even heard of __same_type before :\ would
> be nice if this was in typecheck.h along with the other variations of
> the same idea. Presumably it is a little bit different from those
> somehow?

Good question... commit d2c123c27db8 ("module_param: add __same_type 
convenience wrapper for __builtin_types_compatible_p") introduced it so 
that it could be used in commit fddd52012295 ("module_param: allow 
'bool' module_params to be bool, not just int."); I am guessing that 
typecheck() could not be used in those cases. Perhaps all instances of 
typecheck() could be converted to __same_type()?

Do you want me to send a formal patch for that diff?

Cheers,
Nathan

Powered by blists - more mailing lists