[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d33fbb24119c4d09864e79ea9dfbb881@AcuMS.aculab.com>
Date: Tue, 22 Aug 2023 14:48:08 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Willem de Bruijn' <willemdebruijn.kernel@...il.com>
CC: Mahmoud Maatuq <mahmoudmatook.mm@...il.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-kselftest@...r.kernel.org" <linux-kselftest@...r.kernel.org>,
"kuba@...nel.org" <kuba@...nel.org>, "netdev@...r.kernel.org"
<netdev@...r.kernel.org>, "davem@...emloft.net" <davem@...emloft.net>,
"pabeni@...hat.com" <pabeni@...hat.com>, "edumazet@...gle.com"
<edumazet@...gle.com>, "shuah@...nel.org" <shuah@...nel.org>,
"linux-kernel-mentees@...ts.linuxfoundation.org"
<linux-kernel-mentees@...ts.linuxfoundation.org>
Subject: RE: [PATCH 1/2] selftests: Provide local define of min() and max()
...
> > That typecheck() is horrid.
> > It may well have caused more bugs due to incorrect casts that
> > it actually detected.
> >
> > I'd suggest the version that just avoids multiple evaluations.
> > Or just error signed v unsigned comparisons.
> > See https://lore.kernel.org/all/b4ce9dad748e489f9314a2dc95615033@AcuMS.aculab.com/
> > for an example patch set.
>
> Interesting, thanks. That is also simpler.
>
> Also, the existing patch is no worse than the open coded code today,
> so even without code to avoid multiple evaluations, I guess it's okay
> to merge.
>
> The coccinelle warnings are arguably false positives, using checks for
> kernel code, but being run against userspace code that has no access
> to those helpers. But fine to silence them.
You can't use is_constexpr() unless 'sizeof *(void *)' is valid.
And builtin_constant() isn't good enough for builtin_choose_expr().
That might be ok for selftests and tools, but not for generaluserspace.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists