netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] can: ucan: fix alignment constraints
@ 2021-02-04 16:26 Arnd Bergmann
  2021-02-08 13:16 ` Marc Kleine-Budde
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2021-02-04 16:26 UTC (permalink / raw)
  To: Wolfgang Grandegger, Marc Kleine-Budde, David S. Miller, Jakub Kicinski
  Cc: Arnd Bergmann, Vincent Mailhol, Oliver Hartkopp, linux-can,
	netdev, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

struct ucan_message_in contains member with 4-byte alignment
but is itself marked as unaligned, which triggers a warning:

drivers/net/can/usb/ucan.c:249:1: warning: alignment 1 of 'struct ucan_message_in' is less than 4 [-Wpacked-not-aligned]

Mark the outer structure to have the same alignment as the inner
one.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/can/usb/ucan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/can/usb/ucan.c b/drivers/net/can/usb/ucan.c
index fa403c080871..536c985dad21 100644
--- a/drivers/net/can/usb/ucan.c
+++ b/drivers/net/can/usb/ucan.c
@@ -246,7 +246,7 @@ struct ucan_message_in {
 		 */
 		struct ucan_tx_complete_entry_t can_tx_complete_msg[0];
 	} __aligned(0x4) msg;
-} __packed;
+} __packed __aligned(0x4);
 
 /* Macros to calculate message lengths */
 #define UCAN_OUT_HDR_SIZE offsetof(struct ucan_message_out, msg)
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-02-09 13:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-04 16:26 [PATCH] can: ucan: fix alignment constraints Arnd Bergmann
2021-02-08 13:16 ` Marc Kleine-Budde
2021-02-09 10:34   ` David Laight
2021-02-09 11:28     ` Marc Kleine-Budde
2021-02-09 13:53       ` David Laight

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).