mbox series

[v3,0/2] add _statically_true() to simplify GENMASK_INPUT_CHECK()

Message ID 20241112140454.518823-4-mailhol.vincent@wanadoo.fr (mailing list archive)
Headers show
Series add _statically_true() to simplify GENMASK_INPUT_CHECK() | expand

Message

Vincent Mailhol Nov. 12, 2024, 1:59 p.m. UTC
The first patch introduces a new variant of statically_true() named
_statically_true() which rely on __is_constexpr() to produce a
constant expression result which can be used in BUILD_BUG_ON_ZERO()
and other macros which expect a constant expression as input.

The second patch applies this newly created _statically_true() to
GENMASK_INPUT_CHECK().


** Changelog **

v2 -> v3:

   - split the single patch into a series of two patches.

   - add explanation of why _statically_true() is needed in addition
     to the existing statically_true(). Explain the pros and cons of
     each.

   - use __builtin_choose_expr() in _statically_true(). The
     _statically_true() of the v2 works perfectly fine when used in
     conjunction with BUILD_BUG_ON_ZERO() but fails if used, for
     example, in arrays or in static_assert().

Link: https://lore.kernel.org/all/20241111164743.339117-2-mailhol.vincent@wanadoo.fr/

v1 -> v2:

   - introduce _statically_true(), taking inspiration from
     statically_true() as introduced in commit 22f546873149 ("minmax:
     improve macro expansion and type checking").

Link: https://lore.kernel.org/all/20240609073513.256179-1-mailhol.vincent@wanadoo.fr/

Vincent Mailhol (2):
  compiler.h: add _static_assert()
  linux/bits.h: simplify GENMASK_INPUT_CHECK()

 include/linux/bits.h     |  5 ++---
 include/linux/compiler.h | 14 ++++++++++++++
 2 files changed, 16 insertions(+), 3 deletions(-)

Comments

Linus Torvalds Nov. 12, 2024, 5:52 p.m. UTC | #1
On Tue, Nov 12, 2024 at 6:05 AM Vincent Mailhol
<mailhol.vincent@wanadoo.fr> wrote:
>
> v2 -> v3:
>
>    - split the single patch into a series of two patches.

I haven't actually gotten to the patches yet, because all your emails
end up in my spam box.

The reason is because your git-send-email setup is broken, resulting in:

  dmarc=fail (p=QUARANTINE sp=NONE dis=QUARANTINE) header.from=wanadoo.fr

because you claim to use a wanadoo.fr address in your "From:" line:

    From: Vincent Mailhol <mailhol.vincent@wanadoo.fr>

but you actually used gmail to send it, and the DKIM hash was
generated by gmail:

    DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net;

And then DMARC complains because the From: and the DKIM doesn't match.

So to actually get the right DKIM hashes, you need to either

 (a) send email using the wanadoo.fr smtp gateway

or

 (b) make the sender be that gmail address that you actually use for sending.

Pls fix.

                  Linus
Vincent Mailhol Nov. 12, 2024, 7:14 p.m. UTC | #2
On 13/11/2024 at 02:52, Linus Torvalds wrote:
> On Tue, Nov 12, 2024 at 6:05 AM Vincent Mailhol
> <mailhol.vincent@wanadoo.fr> wrote:
>> v2 -> v3:
>>
>>     - split the single patch into a series of two patches.
> I haven't actually gotten to the patches yet, because all your emails
> end up in my spam box.
>
> The reason is because your git-send-email setup is broken, resulting in:
>
>    dmarc=fail (p=QUARANTINE sp=NONE dis=QUARANTINE) header.from=wanadoo.fr
>
> because you claim to use a wanadoo.fr address in your "From:" line:
>
>      From: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
>
> but you actually used gmail to send it, and the DKIM hash was
> generated by gmail:
>
>      DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
>          d=1e100.net;
>
> And then DMARC complains because the From: and the DKIM doesn't match.
>
> So to actually get the right DKIM hashes, you need to either
>
>   (a) send email using the wanadoo.fr smtp gateway
>
> or
>
>   (b) make the sender be that gmail address that you actually use for sending.
>
> Pls fix.

D'oh. Sorry for that and thanks for the notice. I just resent the full 
v3 with the correct smtp gateway (note that you may see it coming from 
smtp.orange.fr, this is the same as smtp.wanadoo.fr).

Yours sincerely,
Vincent Mailhol