commit | 1a23395672658969a4035dcc518ea6cab835c579 | [log] [tgz] |
---|---|---|
author | Manfred Spraul <[email protected]> | Wed Jul 12 14:34:38 2017 -0700 |
committer | Linus Torvalds <[email protected]> | Wed Jul 12 16:26:01 2017 -0700 |
tree | 1d12f7f1f215a186c9ebe31f1fb91db00f9dae1a | |
parent | e41d58185f1444368873d4d7422f7664a68be61d [diff] |
ipc/sem.c: remove sem_base, embed struct sem sma->sem_base is initialized with sma->sem_base = (struct sem *) &sma[1]; The current code has four problems: - There is an unnecessary pointer dereference - sem_base is not needed. - Alignment for struct sem only works by chance. - The current code causes false positive for static code analysis. - This is a cast between different non-void types, which the future randstruct GCC plugin warns on. And, as bonus, the code size gets smaller: Before: 0 .text 00003770 After: 0 .text 0000374e [[email protected]: s/[0]/[]/, per hch] Link: http://lkml.kernel.org/r/[email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Manfred Spraul <[email protected]> Acked-by: Kees Cook <[email protected]> Cc: Kees Cook <[email protected]> Cc: <[email protected]> Cc: Davidlohr Bueso <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Fabian Frederick <[email protected]> Cc: Christoph Hellwig <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>