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: <4ff59df127e24b83a7c3c9d9aba17857@AcuMS.aculab.com>
Date:   Tue, 15 Aug 2023 15:16:26 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Peter Zijlstra' <peterz@...radead.org>,
        Rasmus Villemoes <linux@...musvillemoes.dk>
CC:     Linus Torvalds <torvalds@...ux-foundation.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "dan.j.williams@...el.com" <dan.j.williams@...el.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>
Subject: RE: cleanup: Make no_free_ptr() __must_check

From: Peter Zijlstra
> Sent: 15 August 2023 14:54
...
> > Also, isn't it more complicated than necessary? Can we get rid of the
> > inner stmt expr and tmp var by just making it
> >
> >   ((void) (p), ((typeof(p))__no_free_ptr((void **)&(p)))
> >
> > which is more or less the whole reason comma expressions is a thing.
> 
> Ah, so the point of the statement expression before the comma is to
> validate that (p) is in fact a pointer, and to that effect we assign it
> to a 'void *' temporary.
> 
> If that case is invalid, we'll get a compile fail with a dodgy message.
> 
> I did this, because (void **)&(p) looses type integrity due to the cast.
> 
> But yeah, I suppose it all needs a wee comment.

Perhaps add an is_pointer_type() along with is_signed_type()
(and really is_constexpr()) to a global header.

Various checks can be used including:
#define is_pointer_type(t) (!is_constexpr((t)0))
which gives a 0/1 to play with rather than an immediate error.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ