[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201103175711.10731-6-johan@kernel.org>
Date: Tue, 3 Nov 2020 18:57:08 +0100
From: Johan Hovold <johan@...nel.org>
To: linux-kernel@...r.kernel.org
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Rob Herring <robh+dt@...nel.org>,
Frank Rowand <frowand.list@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jessica Yu <jeyu@...nel.org>,
Nick Desaulniers <ndesaulniers@...ogle.com>,
Arnd Bergmann <arnd@...db.de>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
David Miller <davem@...emloft.net>,
Jakub Jelinek <jakub@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Steven Rostedt <rostedt@...dmis.org>,
Daniel Kurtz <djkurtz@...omium.org>,
linux-arch@...r.kernel.org, linux-m68k@...ts.linux-m68k.org,
Johan Hovold <johan@...nel.org>
Subject: [PATCH 5/8] init: use type alignment for kernel parameters
Specify type alignment for kernel parameters instead of sizeof(long).
The alignment attribute is used to prevent gcc from increasing the
alignment of objects with static extent, something which would mess up
the __setup array stride.
Using __alignof__(struct obs_kernel_param) rather than sizeof(long) is
preferred since it better indicates why it is there and doesn't break
should the type size or alignment change.
Note that on m68k the alignment of struct obs_kernel_param is actually
two and that adding a 1- or 2-byte field to the 12-byte struct would
cause a breakage with the current 4-byte alignment.
Signed-off-by: Johan Hovold <johan@...nel.org>
---
include/linux/init.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/init.h b/include/linux/init.h
index 7b53cb3092ee..e668832ef66a 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -255,7 +255,7 @@ struct obs_kernel_param {
__aligned(1) = str; \
static struct obs_kernel_param __setup_##unique_id \
__used __section(".init.setup") \
- __attribute__((aligned((sizeof(long))))) \
+ __aligned(__alignof__(struct obs_kernel_param)) \
= { __setup_str_##unique_id, fn, early }
#define __setup(str, fn) \
--
2.26.2
Powered by blists - more mailing lists