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]
Message-ID: <CAK8P3a13pWLNdE6-BP8GEtSait66=V+Wo7GPWP-FkyXMHP5tPQ@mail.gmail.com>
Date:   Sun, 21 Nov 2021 14:22:35 +0100
From:   Arnd Bergmann <arnd@...db.de>
To:     Alejandro Colomar <alx.manpages@...il.com>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Arnd Bergmann <arnd@...db.de>,
        Alexey Dobriyan <adobriyan@...il.com>,
        Jani Nikula <jani.nikula@...ux.intel.com>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        Kees Cook <keescook@...omium.org>,
        Joe Perches <joe@...ches.com>
Subject: Re: [PATCH v2 17/20] linux/array_size.h: Add __is_array(a) to help readability

On Sat, Nov 20, 2021 at 2:01 PM Alejandro Colomar
<alx.manpages@...il.com> wrote:
>
>  /* &a[0] degrades to a pointer: a different type from an array */
> -#define __must_be_array(a)  __must_be(!__same_type((a), &(a)[0]))
> +#define __is_array(a)  (!__same_type((a), &(a)[0]))
> +
> +#define __must_be_array(a)  __must_be(__is_array(a))

I'd go the other way here if you want to improve this, and open-code it
to avoid nested macros. That produces more readable error messages
with recent compilers that try to unwind each macro one at a time.

      Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ