[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <63bc30d717314a378064953879605e7c@AcuMS.aculab.com>
Date: Wed, 29 Jul 2020 08:04:51 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Christoph Hellwig' <hch@....de>,
"David S. Miller" <davem@...emloft.net>
CC: Jan Engelhardt <jengelh@...i.de>, Ido Schimmel <idosch@...sch.org>,
"Jason A. Donenfeld" <Jason@...c4.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [PATCH 2/4] net: make sockptr_is_null strict aliasing safe
From: Christoph Hellwig <hch@....de>
> Sent: 28 July 2020 17:39
>
> While the kernel in general is not strict aliasing safe we can trivially
> do that in sockptr_is_null without affecting code generation, so always
> check the actually assigned union member.
Even with 'strict aliasing' gcc (at least) guarantees that
the members of a union alias each other.
It is about the only way so safely interpret a float as an int.
So when sockptr_t is a union testing either member is enough.
When it is a structure the changed form almost certainly adds code.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists