net: marvell: prestera: Add explicit padding
authorGeert Uytterhoeven <geert@linux-m68k.org>
Tue, 2 Nov 2021 08:24:33 +0000 (09:24 +0100)
committerJakub Kicinski <kuba@kernel.org>
Wed, 3 Nov 2021 01:08:58 +0000 (18:08 -0700)
commit236f57fe1b8853fb3505502c0f94ae64d153ae92
treedafc4fa840374aa52e35e19e884fe61282694b36
parent6ab9f57a648953e2326b9ad000783c122d133c9d
net: marvell: prestera: Add explicit padding

On m68k:

    In function ‘prestera_hw_build_tests’,
inlined from ‘prestera_hw_switch_init’ at drivers/net/ethernet/marvell/prestera/prestera_hw.c:788:2:
    ././include/linux/compiler_types.h:335:38: error: call to ‘__compiletime_assert_345’ declared with attribute error: BUILD_BUG_ON failed: sizeof(struct prestera_msg_switch_attr_req) != 16
    ...

The driver assumes structure members are naturally aligned, but does not
add explicit padding, thus breaking architectures where integral values
are not always naturally aligned (e.g. on m68k, __alignof(int) is 2, not
4).

Fixes: bb5dbf2cc64d5cfa ("net: marvell: prestera: add firmware v4.0 support")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20211102082433.3820514-1-geert@linux-m68k.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/marvell/prestera/prestera_hw.c