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] [day] [month] [year] [list]
Message-ID: <CAMuHMdXQ3MxtJycmTxomz_iJnYj6-2Mf8t7jUzoY490O2DhQfQ@mail.gmail.com>
Date:   Mon, 23 Jan 2023 15:49:38 +0100
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Jakub Jelinek <jakub@...hat.com>
Cc:     Michael Karcher <kernel@...rcher.dialup.fu-berlin.de>,
        Randy Dunlap <rdunlap@...radead.org>,
        linux-kernel@...r.kernel.org, linux-sh@...r.kernel.org,
        Segher Boessenkool <segher@...nel.crashing.org>,
        Rich Felker <dalias@...c.org>,
        Yoshinori Sato <ysato@...rs.osdn.me>,
        John Paul Adrian Glaubitz <glaubitz@...sik.fu-berlin.de>,
        jakub@....gnu.org
Subject: Re: [PATCH: 1/1] sh4: avoid spurious gcc warning

Hi Jakub,

On Sun, Jan 22, 2023 at 1:47 PM Jakub Jelinek <jakub@...hat.com> wrote:
> On Sun, Jan 22, 2023 at 12:33:41PM +0100, Michael Karcher wrote:
> > Am 22.01.2023 um 08:00 schrieb Randy Dunlap:
> > > > -#define _INTC_ARRAY(a) a, __same_type(a, NULL) ? 0 : sizeof(a)/sizeof(*a)
> > > > +#define _INTC_ARRAY(a) a, sizeof(a)/(_Generic((a), typeof(NULL): 0xFFFFFFFFU, default: sizeof(*a)))
> > > s/: / : / in 2 places.
> > >
> > > Tested-by: Randy Dunlap <rdunlap@...radead.org> # build-tested
> >
> > Thanks for your confirmation! Are you sure about the space before the colon?
>
> No, it should be without those, see various other _Generic uses in
> include/linux/
> All those are formatted on one line for each case, so for the above macro it
> would be
> #define _INTC_ARRAY(a) (a), sizeof(a)/(_Generic((a),                    \
>                                        typeof(NULL):    -1,             \
>                                        default:         sizeof(*(a)))
> or so.
> Anyway, two comments:
> 1) I'd use -1 as that would be after promotion to size_t the largest size_t
>    unlike 0xFFFFFFFFU; of course, as for the void * case a can't be an array,
>    any value > sizeof(void*) will do

Or SIZE_MAX.

include/linux/limits.h:#define SIZE_MAX (~(size_t)0)

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ