On 14/07/2020 16:56, David Sterba wrote: > On Tue, Jul 14, 2020 at 02:49:31PM +0000, Johannes Thumshirn wrote: >> On 14/07/2020 14:33, David Sterba wrote: >>> On Tue, Jul 14, 2020 at 06:32:36PM +0900, Johannes Thumshirn wrote: >>>> When expanding ioctl interfaces we want to make sure we're not changing >>>> the size of the structures, otherwise it can lead to incorrect transfers >>>> between kernel and user-space. >>>> >>>> Build time assert the size of each structure so we're not running into any >>>> incompatibilities. >>>> >>>> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@xxxxxxx> >>> >>> I've tried 32bit build and the assertion fails for many structures, but >>> I was expecting only the send one because it contains the pointer. >> >> I wonder if we should have two different asserts for 32 and 64bit for >> these structures or remove the asserts from them. >> >> Having a 32 and 64bit assert will add some ifdeffery, let me see how >> ugly this will get. > > Progs do the switch using sizeof(long) and ?: operator but I don't know > if this works with _Static_assert as progs use the struct + bitfield > way. > I can try but it's ugly as hell IMHO
