Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

can.h: make padding given by gcc explicit

The current definition of struct can_frame has a 16-byte size, with 8-byte
alignment, but the 3 bytes of padding are not explicit like the similar 2 bytes
of padding of struct canfd_frame. Make it explicit so it is easier to read.

Signed-off-by: Shawn Landden <shawn@churchofgit.com>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

authored by

Shawn Landden and committed by
Marc Kleine-Budde
a2f11835 239fb791

+9
+3
Documentation/networking/can.txt
··· 268 268 struct can_frame { 269 269 canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */ 270 270 __u8 can_dlc; /* frame payload length in byte (0 .. 8) */ 271 + __u8 __pad; /* padding */ 272 + __u8 __res0; /* reserved / padding */ 273 + __u8 __res1; /* reserved / padding */ 271 274 __u8 data[8] __attribute__((aligned(8))); 272 275 }; 273 276
+6
include/uapi/linux/can.h
··· 95 95 * @can_dlc: frame payload length in byte (0 .. 8) aka data length code 96 96 * N.B. the DLC field from ISO 11898-1 Chapter 8.4.2.3 has a 1:1 97 97 * mapping of the 'data length code' to the real payload length 98 + * @__pad: padding 99 + * @__res0: reserved / padding 100 + * @__res1: reserved / padding 98 101 * @data: CAN frame payload (up to 8 byte) 99 102 */ 100 103 struct can_frame { 101 104 canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */ 102 105 __u8 can_dlc; /* frame payload length in byte (0 .. CAN_MAX_DLEN) */ 106 + __u8 __pad; /* padding */ 107 + __u8 __res0; /* reserved / padding */ 108 + __u8 __res1; /* reserved / padding */ 103 109 __u8 data[CAN_MAX_DLEN] __attribute__((aligned(8))); 104 110 }; 105 111