Advertisement
Guest User

Untitled

a guest
Jun 19th, 2023
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 38.65 KB | None | 0 0
  1. commit 50d585f788792c2344cf3b60dad947ac4223aee4
  2. Author: Arnd Bergmann <[email protected]>
  3. Date: Mon Jun 19 11:32:24 2023 +0200
  4.  
  5. struct packing
  6.  
  7. Signed-off-by: Arnd Bergmann <[email protected]>
  8.  
  9. diff --git a/drivers/dma/dw-edma/dw-edma-v0-regs.h b/drivers/dma/dw-edma/dw-edma-v0-regs.h
  10. index e175f7b20480e..54800f9d9e460 100644
  11. --- a/drivers/dma/dw-edma/dw-edma-v0-regs.h
  12. +++ b/drivers/dma/dw-edma/dw-edma-v0-regs.h
  13. @@ -29,41 +29,41 @@ struct dw_edma_v0_ch_regs {
  14. u32 ch_control2; /* 0x0004 */
  15. u32 transfer_size; /* 0x0008 */
  16. union {
  17. - u64 reg; /* 0x000c..0x0010 */
  18. + u64 reg __packed; /* 0x000c..0x0010 */
  19. struct {
  20. u32 lsb; /* 0x000c */
  21. u32 msb; /* 0x0010 */
  22. };
  23. } sar;
  24. union {
  25. - u64 reg; /* 0x0014..0x0018 */
  26. + u64 reg __packed; /* 0x0014..0x0018 */
  27. struct {
  28. u32 lsb; /* 0x0014 */
  29. u32 msb; /* 0x0018 */
  30. };
  31. } dar;
  32. union {
  33. - u64 reg; /* 0x001c..0x0020 */
  34. + u64 reg __packed; /* 0x001c..0x0020 */
  35. struct {
  36. u32 lsb; /* 0x001c */
  37. u32 msb; /* 0x0020 */
  38. };
  39. } llp;
  40. -} __packed;
  41. +} __packed __aligned(4);
  42.  
  43. struct dw_edma_v0_ch {
  44. struct dw_edma_v0_ch_regs wr; /* 0x0200 */
  45. u32 padding_1[55]; /* 0x0224..0x02fc */
  46. struct dw_edma_v0_ch_regs rd; /* 0x0300 */
  47. u32 padding_2[55]; /* 0x0324..0x03fc */
  48. -} __packed;
  49. +} __packed __aligned(4);
  50.  
  51. struct dw_edma_v0_unroll {
  52. u32 padding_1; /* 0x00f8 */
  53. u32 wr_engine_chgroup; /* 0x0100 */
  54. u32 rd_engine_chgroup; /* 0x0104 */
  55. union {
  56. - u64 reg; /* 0x0108..0x010c */
  57. + u64 reg __packed; /* 0x0108..0x010c */
  58. struct {
  59. u32 lsb; /* 0x0108 */
  60. u32 msb; /* 0x010c */
  61. @@ -71,7 +71,7 @@ struct dw_edma_v0_unroll {
  62. } wr_engine_hshake_cnt;
  63. u32 padding_2[2]; /* 0x0110..0x0114 */
  64. union {
  65. - u64 reg; /* 0x0120..0x0124 */
  66. + u64 reg __packed; /* 0x0120..0x0124 */
  67. struct {
  68. u32 lsb; /* 0x0120 */
  69. u32 msb; /* 0x0124 */
  70. @@ -97,12 +97,12 @@ struct dw_edma_v0_unroll {
  71. u32 rd_ch7_pwr_en; /* 0x0184 */
  72. u32 padding_5[30]; /* 0x0188..0x01fc */
  73. struct dw_edma_v0_ch ch[EDMA_V0_MAX_NR_CH]; /* 0x0200..0x1120 */
  74. -} __packed;
  75. +} __packed __aligned(4);
  76.  
  77. struct dw_edma_v0_legacy {
  78. u32 viewport_sel; /* 0x00f8 */
  79. struct dw_edma_v0_ch_regs ch; /* 0x0100..0x0120 */
  80. -} __packed;
  81. +} __packed __aligned(4);
  82.  
  83. struct dw_edma_v0_regs {
  84. /* eDMA global registers */
  85. @@ -113,7 +113,7 @@ struct dw_edma_v0_regs {
  86. u32 wr_doorbell; /* 0x0010 */
  87. u32 padding_2; /* 0x0014 */
  88. union {
  89. - u64 reg; /* 0x0018..0x001c */
  90. + u64 reg __packed; /* 0x0018..0x001c */
  91. struct {
  92. u32 lsb; /* 0x0018 */
  93. u32 msb; /* 0x001c */
  94. @@ -124,7 +124,7 @@ struct dw_edma_v0_regs {
  95. u32 rd_doorbell; /* 0x0030 */
  96. u32 padding_4; /* 0x0034 */
  97. union {
  98. - u64 reg; /* 0x0038..0x003c */
  99. + u64 reg __packed; /* 0x0038..0x003c */
  100. struct {
  101. u32 lsb; /* 0x0038 */
  102. u32 msb; /* 0x003c */
  103. @@ -138,14 +138,14 @@ struct dw_edma_v0_regs {
  104. u32 wr_int_clear; /* 0x0058 */
  105. u32 wr_err_status; /* 0x005c */
  106. union {
  107. - u64 reg; /* 0x0060..0x0064 */
  108. + u64 reg __packed; /* 0x0060..0x0064 */
  109. struct {
  110. u32 lsb; /* 0x0060 */
  111. u32 msb; /* 0x0064 */
  112. };
  113. } wr_done_imwr;
  114. union {
  115. - u64 reg; /* 0x0068..0x006c */
  116. + u64 reg __packed; /* 0x0068..0x006c */
  117. struct {
  118. u32 lsb; /* 0x0068 */
  119. u32 msb; /* 0x006c */
  120. @@ -164,7 +164,7 @@ struct dw_edma_v0_regs {
  121. u32 rd_int_clear; /* 0x00ac */
  122. u32 padding_10; /* 0x00b0 */
  123. union {
  124. - u64 reg; /* 0x00b4..0x00b8 */
  125. + u64 reg __packed; /* 0x00b4..0x00b8 */
  126. struct {
  127. u32 lsb; /* 0x00b4 */
  128. u32 msb; /* 0x00b8 */
  129. @@ -174,14 +174,14 @@ struct dw_edma_v0_regs {
  130. u32 rd_linked_list_err_en; /* 0x00c4 */
  131. u32 padding_12; /* 0x00c8 */
  132. union {
  133. - u64 reg; /* 0x00cc..0x00d0 */
  134. + u64 reg __packed; /* 0x00cc..0x00d0 */
  135. struct {
  136. u32 lsb; /* 0x00cc */
  137. u32 msb; /* 0x00d0 */
  138. };
  139. } rd_done_imwr;
  140. union {
  141. - u64 reg; /* 0x00d4..0x00d8 */
  142. + u64 reg __packed; /* 0x00d4..0x00d8 */
  143. struct {
  144. u32 lsb; /* 0x00d4 */
  145. u32 msb; /* 0x00d8 */
  146. @@ -196,38 +196,38 @@ struct dw_edma_v0_regs {
  147. union dw_edma_v0_type {
  148. struct dw_edma_v0_legacy legacy; /* 0x00f8..0x0120 */
  149. struct dw_edma_v0_unroll unroll; /* 0x00f8..0x1120 */
  150. - } type;
  151. -} __packed;
  152. + } type __packed __aligned(4);
  153. +} __packed __aligned(4);
  154.  
  155. struct dw_edma_v0_lli {
  156. u32 control;
  157. u32 transfer_size;
  158. union {
  159. - u64 reg;
  160. + u64 reg __packed;
  161. struct {
  162. u32 lsb;
  163. u32 msb;
  164. };
  165. } sar;
  166. union {
  167. - u64 reg;
  168. + u64 reg __packed;
  169. struct {
  170. u32 lsb;
  171. u32 msb;
  172. };
  173. } dar;
  174. -} __packed;
  175. +} __packed __aligned(4);
  176.  
  177. struct dw_edma_v0_llp {
  178. u32 control;
  179. u32 reserved;
  180. union {
  181. - u64 reg;
  182. + u64 reg __packed;
  183. struct {
  184. u32 lsb;
  185. u32 msb;
  186. };
  187. } llp;
  188. -} __packed;
  189. +} __packed __aligned(4);
  190.  
  191. #endif /* _DW_EDMA_V0_REGS_H */
  192. diff --git a/drivers/hid/hid-nvidia-shield.c b/drivers/hid/hid-nvidia-shield.c
  193. index 85700cec5eac6..da28b87b7ab8b 100644
  194. --- a/drivers/hid/hid-nvidia-shield.c
  195. +++ b/drivers/hid/hid-nvidia-shield.c
  196. @@ -63,7 +63,7 @@ static_assert(sizeof(enum thunderstrike_led_state) == 1);
  197. struct thunderstrike_hostcmd_board_info {
  198. __le16 revision;
  199. __le16 serial[7];
  200. -};
  201. +} __packed;
  202.  
  203. struct thunderstrike_hostcmd_haptics {
  204. u8 motor_left;
  205. @@ -81,7 +81,7 @@ struct thunderstrike_hostcmd_resp_report {
  206. __le16 fw_version;
  207. enum thunderstrike_led_state led_state;
  208. u8 payload[30];
  209. - };
  210. + } __packed;
  211. } __packed;
  212. static_assert(sizeof(struct thunderstrike_hostcmd_resp_report) ==
  213. THUNDERSTRIKE_HOSTCMD_REPORT_SIZE);
  214. diff --git a/drivers/infiniband/core/mad_priv.h b/drivers/infiniband/core/mad_priv.h
  215. index 1b7445a6f6714..f2d607bb0b967 100644
  216. --- a/drivers/infiniband/core/mad_priv.h
  217. +++ b/drivers/infiniband/core/mad_priv.h
  218. @@ -73,14 +73,14 @@ struct ib_mad_private_header {
  219. struct ib_mad_recv_wc recv_wc;
  220. struct ib_wc wc;
  221. u64 mapping;
  222. -} __packed;
  223. +};
  224.  
  225. struct ib_mad_private {
  226. struct ib_mad_private_header header;
  227. size_t mad_size;
  228. struct ib_grh grh;
  229. u8 mad[];
  230. -} __packed;
  231. +};
  232.  
  233. struct ib_rmpp_segment {
  234. struct list_head list;
  235. diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h
  236. index dee8c97ff0568..07e24ede7d1ce 100644
  237. --- a/drivers/infiniband/ulp/iser/iscsi_iser.h
  238. +++ b/drivers/infiniband/ulp/iser/iscsi_iser.h
  239. @@ -270,7 +270,7 @@ struct iser_rx_desc {
  240. struct ib_sge rx_sg;
  241. struct ib_cqe cqe;
  242. char pad[ISER_RX_PAD_SIZE];
  243. -} __packed;
  244. +} __packed __aligned(4);
  245.  
  246. /**
  247. * struct iser_login_desc - iSER login descriptor
  248. diff --git a/drivers/media/dvb-frontends/as102_fe_types.h b/drivers/media/dvb-frontends/as102_fe_types.h
  249. index 297f9520ebf9d..981e79e75db13 100644
  250. --- a/drivers/media/dvb-frontends/as102_fe_types.h
  251. +++ b/drivers/media/dvb-frontends/as102_fe_types.h
  252. @@ -174,6 +174,7 @@ struct as10x_register_addr {
  253. uint32_t addr;
  254. /* register mode access */
  255. uint8_t mode;
  256. -};
  257. + uint8_t __pad[3];
  258. +} __packed;
  259.  
  260. #endif
  261. diff --git a/drivers/net/ethernet/3com/typhoon.h b/drivers/net/ethernet/3com/typhoon.h
  262. index 38e6dcab4e941..1ee8d1643e082 100644
  263. --- a/drivers/net/ethernet/3com/typhoon.h
  264. +++ b/drivers/net/ethernet/3com/typhoon.h
  265. @@ -171,7 +171,7 @@ struct tx_desc {
  266. __le32 addr;
  267. __le32 addrHi;
  268. } frag;
  269. - u64 tx_addr; /* opaque for hardware, for TX_DESC */
  270. + u64 tx_addr __packed; /* opaque for hardware, for TX_DESC */
  271. };
  272. __le32 processFlags;
  273. #define TYPHOON_TX_PF_NO_CRC cpu_to_le32(0x00000001)
  274. @@ -187,7 +187,7 @@ struct tx_desc {
  275. #define TYPHOON_TX_PF_VLAN_MASK cpu_to_le32(0x0ffff000)
  276. #define TYPHOON_TX_PF_INTERNAL cpu_to_le32(0xf0000000)
  277. #define TYPHOON_TX_PF_VLAN_TAG_SHIFT 12
  278. -} __packed;
  279. +} __packed __aligned(4);
  280.  
  281. /* The TCP Segmentation offload option descriptor
  282. *
  283. diff --git a/drivers/scsi/pm8001/pm8001_hwi.h b/drivers/scsi/pm8001/pm8001_hwi.h
  284. index 961d0465b923f..0b6d1c704be1a 100644
  285. --- a/drivers/scsi/pm8001/pm8001_hwi.h
  286. +++ b/drivers/scsi/pm8001/pm8001_hwi.h
  287. @@ -402,10 +402,10 @@ struct smp_req {
  288. union {
  289. u8 smp_req[32];
  290. struct {
  291. - __le64 long_req_addr;/* sg dma address, LE */
  292. + __le64 long_req_addr __packed;/* sg dma address, LE */
  293. __le32 long_req_size;/* LE */
  294. u32 _r_a;
  295. - __le64 long_resp_addr;/* sg dma address, LE */
  296. + __le64 long_resp_addr __packed;/* sg dma address, LE */
  297. __le32 long_resp_size;/* LE */
  298. u32 _r_b;
  299. } long_smp_req;/* sequencer extension */
  300. diff --git a/drivers/scsi/pm8001/pm80xx_hwi.h b/drivers/scsi/pm8001/pm80xx_hwi.h
  301. index acf6e3005b842..f3cc469a18602 100644
  302. --- a/drivers/scsi/pm8001/pm80xx_hwi.h
  303. +++ b/drivers/scsi/pm8001/pm80xx_hwi.h
  304. @@ -639,10 +639,10 @@ struct smp_req {
  305. union {
  306. u8 smp_req[32];
  307. struct {
  308. - __le64 long_req_addr;/* sg dma address, LE */
  309. + __le64 long_req_addr __packed;/* sg dma address, LE */
  310. __le32 long_req_size;/* LE */
  311. u32 _r_a;
  312. - __le64 long_resp_addr;/* sg dma address, LE */
  313. + __le64 long_resp_addr __packed;/* sg dma address, LE */
  314. __le32 long_resp_size;/* LE */
  315. u32 _r_b;
  316. } long_smp_req;/* sequencer extension */
  317. diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
  318. index 37b56ce75f39d..1f2d14077f764 100644
  319. --- a/drivers/usb/typec/tipd/core.c
  320. +++ b/drivers/usb/typec/tipd/core.c
  321. @@ -56,8 +56,8 @@ enum {
  322. /* TPS_REG_RX_IDENTITY_SOP */
  323. struct tps6598x_rx_identity_reg {
  324. u8 status;
  325. - struct usb_pd_identity identity;
  326. -} __packed;
  327. + struct usb_pd_identity identity __packed;
  328. +};
  329.  
  330. /* Standard Task return codes */
  331. #define TPS_TASK_TIMEOUT 1
  332. diff --git a/include/linux/platform_data/cros_ec_commands.h b/include/linux/platform_data/cros_ec_commands.h
  333. index ab721cf13a986..61a5dde1511fc 100644
  334. --- a/include/linux/platform_data/cros_ec_commands.h
  335. +++ b/include/linux/platform_data/cros_ec_commands.h
  336. @@ -2684,7 +2684,7 @@ struct ec_params_motion_sense {
  337. */
  338. int16_t hys_degree;
  339. } tablet_mode_threshold;
  340. - };
  341. + } __packed;
  342. } __ec_todo_packed;
  343.  
  344. struct ec_response_motion_sense {
  345. diff --git a/include/linux/tpm.h b/include/linux/tpm.h
  346. index 6a1e8f1572551..d8bc599e0a679 100644
  347. --- a/include/linux/tpm.h
  348. +++ b/include/linux/tpm.h
  349. @@ -288,13 +288,13 @@ enum tpm_chip_flags {
  350. #define to_tpm_chip(d) container_of(d, struct tpm_chip, dev)
  351.  
  352. struct tpm_header {
  353. - __be16 tag;
  354. - __be32 length;
  355. + __be16 tag __packed;
  356. + __be32 length __packed;
  357. union {
  358. - __be32 ordinal;
  359. - __be32 return_code;
  360. + __be32 ordinal __packed;
  361. + __be32 return_code __packed;
  362. };
  363. -} __packed;
  364. +};
  365.  
  366. /* A string buffer type for constructing TPM commands. This is based on the
  367. * ideas of string buffer code in security/keys/trusted.h but is heap based
  368. diff --git a/include/linux/usb/pd.h b/include/linux/usb/pd.h
  369. index c59fb79a42e86..09fb71f7375cf 100644
  370. --- a/include/linux/usb/pd.h
  371. +++ b/include/linux/usb/pd.h
  372. @@ -195,7 +195,7 @@ struct pd_chunked_ext_message_data {
  373. struct pd_message {
  374. __le16 header;
  375. union {
  376. - __le32 payload[PD_MAX_PAYLOAD];
  377. + __le32 payload[PD_MAX_PAYLOAD] __packed;
  378. struct pd_chunked_ext_message_data ext_msg;
  379. };
  380. } __packed;
  381. diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
  382. index 5c72d1864dd6c..796e5595a7c11 100644
  383. --- a/include/net/sctp/structs.h
  384. +++ b/include/net/sctp/structs.h
  385. @@ -341,7 +341,7 @@ struct sctp_signed_cookie {
  386. __u8 signature[SCTP_SECRET_SIZE];
  387. __u32 __pad; /* force sctp_cookie alignment to 64 bits */
  388. struct sctp_cookie c;
  389. -} __packed;
  390. +} __aligned(__alignof__(struct sctp_cookie));
  391.  
  392. /* This is another convenience type to allocate memory for address
  393. * params for the maximum size and pass such structures around
  394. diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
  395. index 1e7774ac808f0..905b4146426b7 100644
  396. --- a/include/rdma/ib_verbs.h
  397. +++ b/include/rdma/ib_verbs.h
  398. @@ -1366,7 +1366,7 @@ enum ib_send_flags {
  399. };
  400.  
  401. struct ib_sge {
  402. - u64 addr;
  403. + u64 addr __packed;
  404. u32 length;
  405. u32 lkey;
  406. };
  407. diff --git a/include/scsi/scsi_bsg_iscsi.h b/include/scsi/scsi_bsg_iscsi.h
  408. index 9b1f0f424a793..5410c55799606 100644
  409. --- a/include/scsi/scsi_bsg_iscsi.h
  410. +++ b/include/scsi/scsi_bsg_iscsi.h
  411. @@ -53,7 +53,7 @@ struct iscsi_bsg_host_vendor {
  412.  
  413. /* start of vendor command area */
  414. uint32_t vendor_cmd[];
  415. -};
  416. +} __packed;
  417.  
  418. /* Response:
  419. */
  420. diff --git a/include/uapi/linux/dvb/frontend.h b/include/uapi/linux/dvb/frontend.h
  421. index 7e0983b987c2d..1cb79399f7b5c 100644
  422. --- a/include/uapi/linux/dvb/frontend.h
  423. +++ b/include/uapi/linux/dvb/frontend.h
  424. @@ -854,8 +854,8 @@ struct dtv_stats {
  425. union {
  426. __u64 uvalue; /* for counters and relative scales */
  427. __s64 svalue; /* for 0.001 dB measures */
  428. - };
  429. -} __attribute__ ((packed));
  430. + } __packed;
  431. +};
  432.  
  433.  
  434. #define MAX_DTV_STATS 4
  435. diff --git a/include/uapi/linux/if_pppol2tp.h b/include/uapi/linux/if_pppol2tp.h
  436. index a91044328bc90..d5bbe250971a3 100644
  437. --- a/include/uapi/linux/if_pppol2tp.h
  438. +++ b/include/uapi/linux/if_pppol2tp.h
  439. @@ -33,7 +33,7 @@ struct pppol2tp_addr {
  440.  
  441. __u16 s_tunnel, s_session; /* For matching incoming packets */
  442. __u16 d_tunnel, d_session; /* For sending outgoing packets */
  443. -};
  444. +} __packed;
  445.  
  446. /* Structure used to connect() the socket to a particular tunnel UDP
  447. * socket over IPv6.
  448. @@ -47,7 +47,7 @@ struct pppol2tpin6_addr {
  449. __u16 d_tunnel, d_session; /* For sending outgoing packets */
  450.  
  451. struct sockaddr_in6 addr; /* IP address and port to send to */
  452. -};
  453. +} __packed;
  454.  
  455. /* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
  456. * bits. So we need a different sockaddr structure.
  457. @@ -61,7 +61,7 @@ struct pppol2tpv3_addr {
  458.  
  459. __u32 s_tunnel, s_session; /* For matching incoming packets */
  460. __u32 d_tunnel, d_session; /* For sending outgoing packets */
  461. -};
  462. +} __packed;
  463.  
  464. struct pppol2tpv3in6_addr {
  465. __kernel_pid_t pid; /* pid that owns the fd.
  466. @@ -72,7 +72,7 @@ struct pppol2tpv3in6_addr {
  467. __u32 d_tunnel, d_session; /* For sending outgoing packets */
  468.  
  469. struct sockaddr_in6 addr; /* IP address and port to send to */
  470. -};
  471. +} __packed;
  472.  
  473. /* Socket options:
  474. * DEBUG - bitmask of debug message categories (not used)
  475. diff --git a/include/uapi/linux/if_pppox.h b/include/uapi/linux/if_pppox.h
  476. index 9abd80dcc46f9..23a8391391d14 100644
  477. --- a/include/uapi/linux/if_pppox.h
  478. +++ b/include/uapi/linux/if_pppox.h
  479. @@ -66,8 +66,8 @@ struct sockaddr_pppox {
  480. __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */
  481. unsigned int sa_protocol; /* protocol identifier */
  482. union {
  483. - struct pppoe_addr pppoe;
  484. - struct pptp_addr pptp;
  485. + struct pppoe_addr pppoe __packed;
  486. + struct pptp_addr pptp __packed;
  487. } sa_addr;
  488. } __packed;
  489.  
  490. diff --git a/include/uapi/linux/ipv6.h b/include/uapi/linux/ipv6.h
  491. index ac56605fe9bca..fa1bc4dff17fc 100644
  492. --- a/include/uapi/linux/ipv6.h
  493. +++ b/include/uapi/linux/ipv6.h
  494. @@ -105,8 +105,8 @@ struct rt2_hdr {
  495. struct ipv6_destopt_hao {
  496. __u8 type;
  497. __u8 length;
  498. - struct in6_addr addr;
  499. -} __attribute__((packed));
  500. + struct in6_addr addr __packed;
  501. +};
  502.  
  503. /*
  504. * IPv6 fixed header
  505. diff --git a/include/uapi/linux/rds.h b/include/uapi/linux/rds.h
  506. index c21edb966c196..4f999cb5c28ea 100644
  507. --- a/include/uapi/linux/rds.h
  508. +++ b/include/uapi/linux/rds.h
  509. @@ -212,7 +212,7 @@ struct rds6_info_socket {
  510. __be16 connected_port;
  511. __u32 rcvbuf;
  512. __u64 inum;
  513. -} __attribute__((packed));
  514. +} __attribute__((packed)) __attribute__((aligned(4)));
  515.  
  516. struct rds_info_tcp_socket {
  517. __be32 local_addr;
  518. @@ -227,17 +227,27 @@ struct rds_info_tcp_socket {
  519. __u8 tos;
  520. } __attribute__((packed));
  521.  
  522. +struct unaligned_in6_addr {
  523. + union {
  524. + __u8 u6_addr8[16];
  525. +#if __UAPI_DEF_IN6_ADDR_ALT
  526. + __be16 u6_addr16[8] __attribute__((packed));
  527. + __be32 u6_addr32[4] __attribute__((packed));
  528. +#endif
  529. + } in6_u;
  530. +};
  531. +
  532. struct rds6_info_tcp_socket {
  533. struct in6_addr local_addr;
  534. __be16 local_port;
  535. - struct in6_addr peer_addr;
  536. + struct unaligned_in6_addr peer_addr;
  537. __be16 peer_port;
  538. __u64 hdr_rem;
  539. __u64 data_rem;
  540. __u32 last_sent_nxt;
  541. __u32 last_expected_una;
  542. __u32 last_seen_una;
  543. -} __attribute__((packed));
  544. +} __attribute__((packed)) __attribute__((aligned(4)));
  545.  
  546. #define RDS_IB_GID_LEN 16
  547. struct rds_info_rdma_connection {
  548. diff --git a/include/uapi/linux/uhid.h b/include/uapi/linux/uhid.h
  549. index cef7534d2d19b..47e1043e77509 100644
  550. --- a/include/uapi/linux/uhid.h
  551. +++ b/include/uapi/linux/uhid.h
  552. @@ -194,7 +194,7 @@ struct uhid_event {
  553. struct uhid_set_report_req set_report;
  554. struct uhid_set_report_reply_req set_report_reply;
  555. struct uhid_start_req start;
  556. - } u;
  557. + } __packed u;
  558. } __attribute__((__packed__));
  559.  
  560. #endif /* __UHID_H_ */
  561. diff --git a/include/uapi/linux/usb/functionfs.h b/include/uapi/linux/usb/functionfs.h
  562. index d77ee6b65328e..2329bbd6bc130 100644
  563. --- a/include/uapi/linux/usb/functionfs.h
  564. +++ b/include/uapi/linux/usb/functionfs.h
  565. @@ -67,7 +67,7 @@ struct usb_os_desc_header {
  566. __u8 Reserved;
  567. };
  568. __le16 wCount;
  569. - };
  570. + } __packed;
  571. } __attribute__((packed));
  572.  
  573. struct usb_ext_compat_desc {
  574. diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
  575. index 3af6a82d0cade..96dffc1f52fc9 100644
  576. --- a/include/uapi/linux/videodev2.h
  577. +++ b/include/uapi/linux/videodev2.h
  578. @@ -1835,7 +1835,7 @@ struct v4l2_ext_control {
  579. struct v4l2_ctrl_av1_frame __user *p_av1_frame;
  580. struct v4l2_ctrl_av1_film_grain __user *p_av1_film_grain;
  581. void __user *ptr;
  582. - };
  583. + } __packed;
  584. } __attribute__ ((packed));
  585.  
  586. struct v4l2_ext_controls {
  587. diff --git a/include/uapi/scsi/scsi_bsg_fc.h b/include/uapi/scsi/scsi_bsg_fc.h
  588. index 5e46cf1054af4..3f402fc48d12e 100644
  589. --- a/include/uapi/scsi/scsi_bsg_fc.h
  590. +++ b/include/uapi/scsi/scsi_bsg_fc.h
  591. @@ -188,7 +188,7 @@ struct fc_bsg_host_ct {commit 50d585f788792c2344cf3b60dad947ac4223aee4
  592. Author: Arnd Bergmann <[email protected]>
  593. Date: Mon Jun 19 11:32:24 2023 +0200
  594.  
  595. struct packing
  596.  
  597. Signed-off-by: Arnd Bergmann <[email protected]>
  598.  
  599. diff --git a/drivers/dma/dw-edma/dw-edma-v0-regs.h b/drivers/dma/dw-edma/dw-edma-v0-regs.h
  600. index e175f7b20480e..54800f9d9e460 100644
  601. --- a/drivers/dma/dw-edma/dw-edma-v0-regs.h
  602. +++ b/drivers/dma/dw-edma/dw-edma-v0-regs.h
  603. @@ -29,41 +29,41 @@ struct dw_edma_v0_ch_regs {
  604. u32 ch_control2; /* 0x0004 */
  605. u32 transfer_size; /* 0x0008 */
  606. union {
  607. - u64 reg; /* 0x000c..0x0010 */
  608. + u64 reg __packed; /* 0x000c..0x0010 */
  609. struct {
  610. u32 lsb; /* 0x000c */
  611. u32 msb; /* 0x0010 */
  612. };
  613. } sar;
  614. union {
  615. - u64 reg; /* 0x0014..0x0018 */
  616. + u64 reg __packed; /* 0x0014..0x0018 */
  617. struct {
  618. u32 lsb; /* 0x0014 */
  619. u32 msb; /* 0x0018 */
  620. };
  621. } dar;
  622. union {
  623. - u64 reg; /* 0x001c..0x0020 */
  624. + u64 reg __packed; /* 0x001c..0x0020 */
  625. struct {
  626. u32 lsb; /* 0x001c */
  627. u32 msb; /* 0x0020 */
  628. };
  629. } llp;
  630. -} __packed;
  631. +} __packed __aligned(4);
  632.  
  633. struct dw_edma_v0_ch {
  634. struct dw_edma_v0_ch_regs wr; /* 0x0200 */
  635. u32 padding_1[55]; /* 0x0224..0x02fc */
  636. struct dw_edma_v0_ch_regs rd; /* 0x0300 */
  637. u32 padding_2[55]; /* 0x0324..0x03fc */
  638. -} __packed;
  639. +} __packed __aligned(4);
  640.  
  641. struct dw_edma_v0_unroll {
  642. u32 padding_1; /* 0x00f8 */
  643. u32 wr_engine_chgroup; /* 0x0100 */
  644. u32 rd_engine_chgroup; /* 0x0104 */
  645. union {
  646. - u64 reg; /* 0x0108..0x010c */
  647. + u64 reg __packed; /* 0x0108..0x010c */
  648. struct {
  649. u32 lsb; /* 0x0108 */
  650. u32 msb; /* 0x010c */
  651. @@ -71,7 +71,7 @@ struct dw_edma_v0_unroll {
  652. } wr_engine_hshake_cnt;
  653. u32 padding_2[2]; /* 0x0110..0x0114 */
  654. union {
  655. - u64 reg; /* 0x0120..0x0124 */
  656. + u64 reg __packed; /* 0x0120..0x0124 */
  657. struct {
  658. u32 lsb; /* 0x0120 */
  659. u32 msb; /* 0x0124 */
  660. @@ -97,12 +97,12 @@ struct dw_edma_v0_unroll {
  661. u32 rd_ch7_pwr_en; /* 0x0184 */
  662. u32 padding_5[30]; /* 0x0188..0x01fc */
  663. struct dw_edma_v0_ch ch[EDMA_V0_MAX_NR_CH]; /* 0x0200..0x1120 */
  664. -} __packed;
  665. +} __packed __aligned(4);
  666.  
  667. struct dw_edma_v0_legacy {
  668. u32 viewport_sel; /* 0x00f8 */
  669. struct dw_edma_v0_ch_regs ch; /* 0x0100..0x0120 */
  670. -} __packed;
  671. +} __packed __aligned(4);
  672.  
  673. struct dw_edma_v0_regs {
  674. /* eDMA global registers */
  675. @@ -113,7 +113,7 @@ struct dw_edma_v0_regs {
  676. u32 wr_doorbell; /* 0x0010 */
  677. u32 padding_2; /* 0x0014 */
  678. union {
  679. - u64 reg; /* 0x0018..0x001c */
  680. + u64 reg __packed; /* 0x0018..0x001c */
  681. struct {
  682. u32 lsb; /* 0x0018 */
  683. u32 msb; /* 0x001c */
  684. @@ -124,7 +124,7 @@ struct dw_edma_v0_regs {
  685. u32 rd_doorbell; /* 0x0030 */
  686. u32 padding_4; /* 0x0034 */
  687. union {
  688. - u64 reg; /* 0x0038..0x003c */
  689. + u64 reg __packed; /* 0x0038..0x003c */
  690. struct {
  691. u32 lsb; /* 0x0038 */
  692. u32 msb; /* 0x003c */
  693. @@ -138,14 +138,14 @@ struct dw_edma_v0_regs {
  694. u32 wr_int_clear; /* 0x0058 */
  695. u32 wr_err_status; /* 0x005c */
  696. union {
  697. - u64 reg; /* 0x0060..0x0064 */
  698. + u64 reg __packed; /* 0x0060..0x0064 */
  699. struct {
  700. u32 lsb; /* 0x0060 */
  701. u32 msb; /* 0x0064 */
  702. };
  703. } wr_done_imwr;
  704. union {
  705. - u64 reg; /* 0x0068..0x006c */
  706. + u64 reg __packed; /* 0x0068..0x006c */
  707. struct {
  708. u32 lsb; /* 0x0068 */
  709. u32 msb; /* 0x006c */
  710. @@ -164,7 +164,7 @@ struct dw_edma_v0_regs {
  711. u32 rd_int_clear; /* 0x00ac */
  712. u32 padding_10; /* 0x00b0 */
  713. union {
  714. - u64 reg; /* 0x00b4..0x00b8 */
  715. + u64 reg __packed; /* 0x00b4..0x00b8 */
  716. struct {
  717. u32 lsb; /* 0x00b4 */
  718. u32 msb; /* 0x00b8 */
  719. @@ -174,14 +174,14 @@ struct dw_edma_v0_regs {
  720. u32 rd_linked_list_err_en; /* 0x00c4 */
  721. u32 padding_12; /* 0x00c8 */
  722. union {
  723. - u64 reg; /* 0x00cc..0x00d0 */
  724. + u64 reg __packed; /* 0x00cc..0x00d0 */
  725. struct {
  726. u32 lsb; /* 0x00cc */
  727. u32 msb; /* 0x00d0 */
  728. };
  729. } rd_done_imwr;
  730. union {
  731. - u64 reg; /* 0x00d4..0x00d8 */
  732. + u64 reg __packed; /* 0x00d4..0x00d8 */
  733. struct {
  734. u32 lsb; /* 0x00d4 */
  735. u32 msb; /* 0x00d8 */
  736. @@ -196,38 +196,38 @@ struct dw_edma_v0_regs {
  737. union dw_edma_v0_type {
  738. struct dw_edma_v0_legacy legacy; /* 0x00f8..0x0120 */
  739. struct dw_edma_v0_unroll unroll; /* 0x00f8..0x1120 */
  740. - } type;
  741. -} __packed;
  742. + } type __packed __aligned(4);
  743. +} __packed __aligned(4);
  744.  
  745. struct dw_edma_v0_lli {
  746. u32 control;
  747. u32 transfer_size;
  748. union {
  749. - u64 reg;
  750. + u64 reg __packed;
  751. struct {
  752. u32 lsb;
  753. u32 msb;
  754. };
  755. } sar;
  756. union {
  757. - u64 reg;
  758. + u64 reg __packed;
  759. struct {
  760. u32 lsb;
  761. u32 msb;
  762. };
  763. } dar;
  764. -} __packed;
  765. +} __packed __aligned(4);
  766.  
  767. struct dw_edma_v0_llp {
  768. u32 control;
  769. u32 reserved;
  770. union {
  771. - u64 reg;
  772. + u64 reg __packed;
  773. struct {
  774. u32 lsb;
  775. u32 msb;
  776. };
  777. } llp;
  778. -} __packed;
  779. +} __packed __aligned(4);
  780.  
  781. #endif /* _DW_EDMA_V0_REGS_H */
  782. diff --git a/drivers/hid/hid-nvidia-shield.c b/drivers/hid/hid-nvidia-shield.c
  783. index 85700cec5eac6..da28b87b7ab8b 100644
  784. --- a/drivers/hid/hid-nvidia-shield.c
  785. +++ b/drivers/hid/hid-nvidia-shield.c
  786. @@ -63,7 +63,7 @@ static_assert(sizeof(enum thunderstrike_led_state) == 1);
  787. struct thunderstrike_hostcmd_board_info {
  788. __le16 revision;
  789. __le16 serial[7];
  790. -};
  791. +} __packed;
  792.  
  793. struct thunderstrike_hostcmd_haptics {
  794. u8 motor_left;
  795. @@ -81,7 +81,7 @@ struct thunderstrike_hostcmd_resp_report {
  796. __le16 fw_version;
  797. enum thunderstrike_led_state led_state;
  798. u8 payload[30];
  799. - };
  800. + } __packed;
  801. } __packed;
  802. static_assert(sizeof(struct thunderstrike_hostcmd_resp_report) ==
  803. THUNDERSTRIKE_HOSTCMD_REPORT_SIZE);
  804. diff --git a/drivers/infiniband/core/mad_priv.h b/drivers/infiniband/core/mad_priv.h
  805. index 1b7445a6f6714..f2d607bb0b967 100644
  806. --- a/drivers/infiniband/core/mad_priv.h
  807. +++ b/drivers/infiniband/core/mad_priv.h
  808. @@ -73,14 +73,14 @@ struct ib_mad_private_header {
  809. struct ib_mad_recv_wc recv_wc;
  810. struct ib_wc wc;
  811. u64 mapping;
  812. -} __packed;
  813. +};
  814.  
  815. struct ib_mad_private {
  816. struct ib_mad_private_header header;
  817. size_t mad_size;
  818. struct ib_grh grh;
  819. u8 mad[];
  820. -} __packed;
  821. +};
  822.  
  823. struct ib_rmpp_segment {
  824. struct list_head list;
  825. diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h
  826. index dee8c97ff0568..07e24ede7d1ce 100644
  827. --- a/drivers/infiniband/ulp/iser/iscsi_iser.h
  828. +++ b/drivers/infiniband/ulp/iser/iscsi_iser.h
  829. @@ -270,7 +270,7 @@ struct iser_rx_desc {
  830. struct ib_sge rx_sg;
  831. struct ib_cqe cqe;
  832. char pad[ISER_RX_PAD_SIZE];
  833. -} __packed;
  834. +} __packed __aligned(4);
  835.  
  836. /**
  837. * struct iser_login_desc - iSER login descriptor
  838. diff --git a/drivers/media/dvb-frontends/as102_fe_types.h b/drivers/media/dvb-frontends/as102_fe_types.h
  839. index 297f9520ebf9d..981e79e75db13 100644
  840. --- a/drivers/media/dvb-frontends/as102_fe_types.h
  841. +++ b/drivers/media/dvb-frontends/as102_fe_types.h
  842. @@ -174,6 +174,7 @@ struct as10x_register_addr {
  843. uint32_t addr;
  844. /* register mode access */
  845. uint8_t mode;
  846. -};
  847. + uint8_t __pad[3];
  848. +} __packed;
  849.  
  850. #endif
  851. diff --git a/drivers/net/ethernet/3com/typhoon.h b/drivers/net/ethernet/3com/typhoon.h
  852. index 38e6dcab4e941..1ee8d1643e082 100644
  853. --- a/drivers/net/ethernet/3com/typhoon.h
  854. +++ b/drivers/net/ethernet/3com/typhoon.h
  855. @@ -171,7 +171,7 @@ struct tx_desc {
  856. __le32 addr;
  857. __le32 addrHi;
  858. } frag;
  859. - u64 tx_addr; /* opaque for hardware, for TX_DESC */
  860. + u64 tx_addr __packed; /* opaque for hardware, for TX_DESC */
  861. };
  862. __le32 processFlags;
  863. #define TYPHOON_TX_PF_NO_CRC cpu_to_le32(0x00000001)
  864. @@ -187,7 +187,7 @@ struct tx_desc {
  865. #define TYPHOON_TX_PF_VLAN_MASK cpu_to_le32(0x0ffff000)
  866. #define TYPHOON_TX_PF_INTERNAL cpu_to_le32(0xf0000000)
  867. #define TYPHOON_TX_PF_VLAN_TAG_SHIFT 12
  868. -} __packed;
  869. +} __packed __aligned(4);
  870.  
  871. /* The TCP Segmentation offload option descriptor
  872. *
  873. diff --git a/drivers/scsi/pm8001/pm8001_hwi.h b/drivers/scsi/pm8001/pm8001_hwi.h
  874. index 961d0465b923f..0b6d1c704be1a 100644
  875. --- a/drivers/scsi/pm8001/pm8001_hwi.h
  876. +++ b/drivers/scsi/pm8001/pm8001_hwi.h
  877. @@ -402,10 +402,10 @@ struct smp_req {
  878. union {
  879. u8 smp_req[32];
  880. struct {
  881. - __le64 long_req_addr;/* sg dma address, LE */
  882. + __le64 long_req_addr __packed;/* sg dma address, LE */
  883. __le32 long_req_size;/* LE */
  884. u32 _r_a;
  885. - __le64 long_resp_addr;/* sg dma address, LE */
  886. + __le64 long_resp_addr __packed;/* sg dma address, LE */
  887. __le32 long_resp_size;/* LE */
  888. u32 _r_b;
  889. } long_smp_req;/* sequencer extension */
  890. diff --git a/drivers/scsi/pm8001/pm80xx_hwi.h b/drivers/scsi/pm8001/pm80xx_hwi.h
  891. index acf6e3005b842..f3cc469a18602 100644
  892. --- a/drivers/scsi/pm8001/pm80xx_hwi.h
  893. +++ b/drivers/scsi/pm8001/pm80xx_hwi.h
  894. @@ -639,10 +639,10 @@ struct smp_req {
  895. union {
  896. u8 smp_req[32];
  897. struct {
  898. - __le64 long_req_addr;/* sg dma address, LE */
  899. + __le64 long_req_addr __packed;/* sg dma address, LE */
  900. __le32 long_req_size;/* LE */
  901. u32 _r_a;
  902. - __le64 long_resp_addr;/* sg dma address, LE */
  903. + __le64 long_resp_addr __packed;/* sg dma address, LE */
  904. __le32 long_resp_size;/* LE */
  905. u32 _r_b;
  906. } long_smp_req;/* sequencer extension */
  907. diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
  908. index 37b56ce75f39d..1f2d14077f764 100644
  909. --- a/drivers/usb/typec/tipd/core.c
  910. +++ b/drivers/usb/typec/tipd/core.c
  911. @@ -56,8 +56,8 @@ enum {
  912. /* TPS_REG_RX_IDENTITY_SOP */
  913. struct tps6598x_rx_identity_reg {
  914. u8 status;
  915. - struct usb_pd_identity identity;
  916. -} __packed;
  917. + struct usb_pd_identity identity __packed;
  918. +};
  919.  
  920. /* Standard Task return codes */
  921. #define TPS_TASK_TIMEOUT 1
  922. diff --git a/include/linux/platform_data/cros_ec_commands.h b/include/linux/platform_data/cros_ec_commands.h
  923. index ab721cf13a986..61a5dde1511fc 100644
  924. --- a/include/linux/platform_data/cros_ec_commands.h
  925. +++ b/include/linux/platform_data/cros_ec_commands.h
  926. @@ -2684,7 +2684,7 @@ struct ec_params_motion_sense {
  927. */
  928. int16_t hys_degree;
  929. } tablet_mode_threshold;
  930. - };
  931. + } __packed;
  932. } __ec_todo_packed;
  933.  
  934. struct ec_response_motion_sense {
  935. diff --git a/include/linux/tpm.h b/include/linux/tpm.h
  936. index 6a1e8f1572551..d8bc599e0a679 100644
  937. --- a/include/linux/tpm.h
  938. +++ b/include/linux/tpm.h
  939. @@ -288,13 +288,13 @@ enum tpm_chip_flags {
  940. #define to_tpm_chip(d) container_of(d, struct tpm_chip, dev)
  941.  
  942. struct tpm_header {
  943. - __be16 tag;
  944. - __be32 length;
  945. + __be16 tag __packed;
  946. + __be32 length __packed;
  947. union {
  948. - __be32 ordinal;
  949. - __be32 return_code;
  950. + __be32 ordinal __packed;
  951. + __be32 return_code __packed;
  952. };
  953. -} __packed;
  954. +};
  955.  
  956. /* A string buffer type for constructing TPM commands. This is based on the
  957. * ideas of string buffer code in security/keys/trusted.h but is heap based
  958. diff --git a/include/linux/usb/pd.h b/include/linux/usb/pd.h
  959. index c59fb79a42e86..09fb71f7375cf 100644
  960. --- a/include/linux/usb/pd.h
  961. +++ b/include/linux/usb/pd.h
  962. @@ -195,7 +195,7 @@ struct pd_chunked_ext_message_data {
  963. struct pd_message {
  964. __le16 header;
  965. union {
  966. - __le32 payload[PD_MAX_PAYLOAD];
  967. + __le32 payload[PD_MAX_PAYLOAD] __packed;
  968. struct pd_chunked_ext_message_data ext_msg;
  969. };
  970. } __packed;
  971. diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
  972. index 5c72d1864dd6c..796e5595a7c11 100644
  973. --- a/include/net/sctp/structs.h
  974. +++ b/include/net/sctp/structs.h
  975. @@ -341,7 +341,7 @@ struct sctp_signed_cookie {
  976. __u8 signature[SCTP_SECRET_SIZE];
  977. __u32 __pad; /* force sctp_cookie alignment to 64 bits */
  978. struct sctp_cookie c;
  979. -} __packed;
  980. +} __aligned(__alignof__(struct sctp_cookie));
  981.  
  982. /* This is another convenience type to allocate memory for address
  983. * params for the maximum size and pass such structures around
  984. diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
  985. index 1e7774ac808f0..905b4146426b7 100644
  986. --- a/include/rdma/ib_verbs.h
  987. +++ b/include/rdma/ib_verbs.h
  988. @@ -1366,7 +1366,7 @@ enum ib_send_flags {
  989. };
  990.  
  991. struct ib_sge {
  992. - u64 addr;
  993. + u64 addr __packed;
  994. u32 length;
  995. u32 lkey;
  996. };
  997. diff --git a/include/scsi/scsi_bsg_iscsi.h b/include/scsi/scsi_bsg_iscsi.h
  998. index 9b1f0f424a793..5410c55799606 100644
  999. --- a/include/scsi/scsi_bsg_iscsi.h
  1000. +++ b/include/scsi/scsi_bsg_iscsi.h
  1001. @@ -53,7 +53,7 @@ struct iscsi_bsg_host_vendor {
  1002.  
  1003. /* start of vendor command area */
  1004. uint32_t vendor_cmd[];
  1005. -};
  1006. +} __packed;
  1007.  
  1008. /* Response:
  1009. */
  1010. diff --git a/include/uapi/linux/dvb/frontend.h b/include/uapi/linux/dvb/frontend.h
  1011. index 7e0983b987c2d..1cb79399f7b5c 100644
  1012. --- a/include/uapi/linux/dvb/frontend.h
  1013. +++ b/include/uapi/linux/dvb/frontend.h
  1014. @@ -854,8 +854,8 @@ struct dtv_stats {
  1015. union {
  1016. __u64 uvalue; /* for counters and relative scales */
  1017. __s64 svalue; /* for 0.001 dB measures */
  1018. - };
  1019. -} __attribute__ ((packed));
  1020. + } __packed;
  1021. +};
  1022.  
  1023.  
  1024. #define MAX_DTV_STATS 4
  1025. diff --git a/include/uapi/linux/if_pppol2tp.h b/include/uapi/linux/if_pppol2tp.h
  1026. index a91044328bc90..d5bbe250971a3 100644
  1027. --- a/include/uapi/linux/if_pppol2tp.h
  1028. +++ b/include/uapi/linux/if_pppol2tp.h
  1029. @@ -33,7 +33,7 @@ struct pppol2tp_addr {
  1030.  
  1031. __u16 s_tunnel, s_session; /* For matching incoming packets */
  1032. __u16 d_tunnel, d_session; /* For sending outgoing packets */
  1033. -};
  1034. +} __packed;
  1035.  
  1036. /* Structure used to connect() the socket to a particular tunnel UDP
  1037. * socket over IPv6.
  1038. @@ -47,7 +47,7 @@ struct pppol2tpin6_addr {
  1039. __u16 d_tunnel, d_session; /* For sending outgoing packets */
  1040.  
  1041. struct sockaddr_in6 addr; /* IP address and port to send to */
  1042. -};
  1043. +} __packed;
  1044.  
  1045. /* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
  1046. * bits. So we need a different sockaddr structure.
  1047. @@ -61,7 +61,7 @@ struct pppol2tpv3_addr {
  1048.  
  1049. __u32 s_tunnel, s_session; /* For matching incoming packets */
  1050. __u32 d_tunnel, d_session; /* For sending outgoing packets */
  1051. -};
  1052. +} __packed;
  1053.  
  1054. struct pppol2tpv3in6_addr {
  1055. __kernel_pid_t pid; /* pid that owns the fd.
  1056. @@ -72,7 +72,7 @@ struct pppol2tpv3in6_addr {
  1057. __u32 d_tunnel, d_session; /* For sending outgoing packets */
  1058.  
  1059. struct sockaddr_in6 addr; /* IP address and port to send to */
  1060. -};
  1061. +} __packed;
  1062.  
  1063. /* Socket options:
  1064. * DEBUG - bitmask of debug message categories (not used)
  1065. diff --git a/include/uapi/linux/if_pppox.h b/include/uapi/linux/if_pppox.h
  1066. index 9abd80dcc46f9..23a8391391d14 100644
  1067. --- a/include/uapi/linux/if_pppox.h
  1068. +++ b/include/uapi/linux/if_pppox.h
  1069. @@ -66,8 +66,8 @@ struct sockaddr_pppox {
  1070. __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */
  1071. unsigned int sa_protocol; /* protocol identifier */
  1072. union {
  1073. - struct pppoe_addr pppoe;
  1074. - struct pptp_addr pptp;
  1075. + struct pppoe_addr pppoe __packed;
  1076. + struct pptp_addr pptp __packed;
  1077. } sa_addr;
  1078. } __packed;
  1079.  
  1080. diff --git a/include/uapi/linux/ipv6.h b/include/uapi/linux/ipv6.h
  1081. index ac56605fe9bca..fa1bc4dff17fc 100644
  1082. --- a/include/uapi/linux/ipv6.h
  1083. +++ b/include/uapi/linux/ipv6.h
  1084. @@ -105,8 +105,8 @@ struct rt2_hdr {
  1085. struct ipv6_destopt_hao {
  1086. __u8 type;
  1087. __u8 length;
  1088. - struct in6_addr addr;
  1089. -} __attribute__((packed));
  1090. + struct in6_addr addr __packed;
  1091. +};
  1092.  
  1093. /*
  1094. * IPv6 fixed header
  1095. diff --git a/include/uapi/linux/rds.h b/include/uapi/linux/rds.h
  1096. index c21edb966c196..4f999cb5c28ea 100644
  1097. --- a/include/uapi/linux/rds.h
  1098. +++ b/include/uapi/linux/rds.h
  1099. @@ -212,7 +212,7 @@ struct rds6_info_socket {
  1100. __be16 connected_port;
  1101. __u32 rcvbuf;
  1102. __u64 inum;
  1103. -} __attribute__((packed));
  1104. +} __attribute__((packed)) __attribute__((aligned(4)));
  1105.  
  1106. struct rds_info_tcp_socket {
  1107. __be32 local_addr;
  1108. @@ -227,17 +227,27 @@ struct rds_info_tcp_socket {
  1109. __u8 tos;
  1110. } __attribute__((packed));
  1111.  
  1112. +struct unaligned_in6_addr {
  1113. + union {
  1114. + __u8 u6_addr8[16];
  1115. +#if __UAPI_DEF_IN6_ADDR_ALT
  1116. + __be16 u6_addr16[8] __attribute__((packed));
  1117. + __be32 u6_addr32[4] __attribute__((packed));
  1118. +#endif
  1119. + } in6_u;
  1120. +};
  1121. +
  1122. struct rds6_info_tcp_socket {
  1123. struct in6_addr local_addr;
  1124. __be16 local_port;
  1125. - struct in6_addr peer_addr;
  1126. + struct unaligned_in6_addr peer_addr;
  1127. __be16 peer_port;
  1128. __u64 hdr_rem;
  1129. __u64 data_rem;
  1130. __u32 last_sent_nxt;
  1131. __u32 last_expected_una;
  1132. __u32 last_seen_una;
  1133. -} __attribute__((packed));
  1134. +} __attribute__((packed)) __attribute__((aligned(4)));
  1135.  
  1136. #define RDS_IB_GID_LEN 16
  1137. struct rds_info_rdma_connection {
  1138. diff --git a/include/uapi/linux/uhid.h b/include/uapi/linux/uhid.h
  1139. index cef7534d2d19b..47e1043e77509 100644
  1140. --- a/include/uapi/linux/uhid.h
  1141. +++ b/include/uapi/linux/uhid.h
  1142. @@ -194,7 +194,7 @@ struct uhid_event {
  1143. struct uhid_set_report_req set_report;
  1144. struct uhid_set_report_reply_req set_report_reply;
  1145. struct uhid_start_req start;
  1146. - } u;
  1147. + } __packed u;
  1148. } __attribute__((__packed__));
  1149.  
  1150. #endif /* __UHID_H_ */
  1151. diff --git a/include/uapi/linux/usb/functionfs.h b/include/uapi/linux/usb/functionfs.h
  1152. index d77ee6b65328e..2329bbd6bc130 100644
  1153. --- a/include/uapi/linux/usb/functionfs.h
  1154. +++ b/include/uapi/linux/usb/functionfs.h
  1155. @@ -67,7 +67,7 @@ struct usb_os_desc_header {
  1156. __u8 Reserved;
  1157. };
  1158. __le16 wCount;
  1159. - };
  1160. + } __packed;
  1161. } __attribute__((packed));
  1162.  
  1163. struct usb_ext_compat_desc {
  1164. diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
  1165. index 3af6a82d0cade..96dffc1f52fc9 100644
  1166. --- a/include/uapi/linux/videodev2.h
  1167. +++ b/include/uapi/linux/videodev2.h
  1168. @@ -1835,7 +1835,7 @@ struct v4l2_ext_control {
  1169. struct v4l2_ctrl_av1_frame __user *p_av1_frame;
  1170. struct v4l2_ctrl_av1_film_grain __user *p_av1_film_grain;
  1171. void __user *ptr;
  1172. - };
  1173. + } __packed;
  1174. } __attribute__ ((packed));
  1175.  
  1176. struct v4l2_ext_controls {
  1177. diff --git a/include/uapi/scsi/scsi_bsg_fc.h b/include/uapi/scsi/scsi_bsg_fc.h
  1178. index 5e46cf1054af4..3f402fc48d12e 100644
  1179. --- a/include/uapi/scsi/scsi_bsg_fc.h
  1180. +++ b/include/uapi/scsi/scsi_bsg_fc.h
  1181. @@ -188,7 +188,7 @@ struct fc_bsg_host_ct {
  1182. __u32 preamble_word1; /* GS_Type, GS_SubType, Options, Rsvd */
  1183. __u32 preamble_word2; /* Cmd Code, Max Size */
  1184.  
  1185. -};
  1186. +} __packed;
  1187. /* Response:
  1188. *
  1189. * The reply structure is an fc_bsg_ctels_reply structure
  1190. @@ -210,7 +210,7 @@ struct fc_bsg_host_vendor {
  1191.  
  1192. /* start of vendor command area */
  1193. __u32 vendor_cmd[];
  1194. -};
  1195. +} __packed;
  1196.  
  1197. /* Response:
  1198. */
  1199. @@ -256,7 +256,7 @@ struct fc_bsg_rport_ct {
  1200. __u32 preamble_word0; /* revision & IN_ID */
  1201. __u32 preamble_word1; /* GS_Type, GS_SubType, Options, Rsvd */
  1202. __u32 preamble_word2; /* Cmd Code, Max Size */
  1203. -};
  1204. +} __packed;
  1205. /* Response:
  1206. *
  1207. * The reply structure is an fc_bsg_ctels_reply structure
  1208. diff --git a/net/smc/smc_llc.c b/net/smc/smc_llc.c
  1209. index 90f0b60b196ab..1c720c2093d91 100644
  1210. --- a/net/smc/smc_llc.c
  1211. +++ b/net/smc/smc_llc.c
  1212. @@ -35,7 +35,7 @@ struct smc_llc_hdr {
  1213. #endif
  1214. };
  1215. u16 length_v2; /* 44 - 8192*/
  1216. - };
  1217. + } __packed;
  1218. u8 flags;
  1219. } __packed; /* format defined in
  1220. * IBM Shared Memory Communications Version 2
  1221. diff --git a/sound/soc/codecs/mt6660.h b/sound/soc/codecs/mt6660.h
  1222. index 054a3c56ec1fe..6c40b4065f24a 100644
  1223. --- a/sound/soc/codecs/mt6660.h
  1224. +++ b/sound/soc/codecs/mt6660.h
  1225. @@ -9,7 +9,6 @@
  1226. #include <linux/mutex.h>
  1227. #include <linux/regmap.h>
  1228.  
  1229. -#pragma pack(push, 1)
  1230. struct mt6660_platform_data {
  1231. u8 init_setting_num;
  1232. u32 *init_setting_addr;
  1233. @@ -26,7 +25,6 @@ struct mt6660_chip {
  1234. struct regmap *regmap;
  1235. u16 chip_rev;
  1236. };
  1237. -#pragma pack(pop)
  1238.  
  1239. #define MT6660_REG_DEVID (0x00)
  1240. #define MT6660_REG_SYSTEM_CTRL (0x03)
  1241.  
  1242. __u32 preamble_word1; /* GS_Type, GS_SubType, Options, Rsvd */
  1243. __u32 preamble_word2; /* Cmd Code, Max Size */
  1244.  
  1245. -};
  1246. +} __packed;
  1247. /* Response:
  1248. *
  1249. * The reply structure is an fc_bsg_ctels_reply structure
  1250. @@ -210,7 +210,7 @@ struct fc_bsg_host_vendor {
  1251.  
  1252. /* start of vendor command area */
  1253. __u32 vendor_cmd[];
  1254. -};
  1255. +} __packed;
  1256.  
  1257. /* Response:
  1258. */
  1259. @@ -256,7 +256,7 @@ struct fc_bsg_rport_ct {
  1260. __u32 preamble_word0; /* revision & IN_ID */
  1261. __u32 preamble_word1; /* GS_Type, GS_SubType, Options, Rsvd */
  1262. __u32 preamble_word2; /* Cmd Code, Max Size */
  1263. -};
  1264. +} __packed;
  1265. /* Response:
  1266. *
  1267. * The reply structure is an fc_bsg_ctels_reply structure
  1268. diff --git a/net/smc/smc_llc.c b/net/smc/smc_llc.c
  1269. index 90f0b60b196ab..1c720c2093d91 100644
  1270. --- a/net/smc/smc_llc.c
  1271. +++ b/net/smc/smc_llc.c
  1272. @@ -35,7 +35,7 @@ struct smc_llc_hdr {
  1273. #endif
  1274. };
  1275. u16 length_v2; /* 44 - 8192*/
  1276. - };
  1277. + } __packed;
  1278. u8 flags;
  1279. } __packed; /* format defined in
  1280. * IBM Shared Memory Communications Version 2
  1281. diff --git a/sound/soc/codecs/mt6660.h b/sound/soc/codecs/mt6660.h
  1282. index 054a3c56ec1fe..6c40b4065f24a 100644
  1283. --- a/sound/soc/codecs/mt6660.h
  1284. +++ b/sound/soc/codecs/mt6660.h
  1285. @@ -9,7 +9,6 @@
  1286. #include <linux/mutex.h>
  1287. #include <linux/regmap.h>
  1288.  
  1289. -#pragma pack(push, 1)
  1290. struct mt6660_platform_data {
  1291. u8 init_setting_num;
  1292. u32 *init_setting_addr;
  1293. @@ -26,7 +25,6 @@ struct mt6660_chip {
  1294. struct regmap *regmap;
  1295. u16 chip_rev;
  1296. };
  1297. -#pragma pack(pop)
  1298.  
  1299. #define MT6660_REG_DEVID (0x00)
  1300. #define MT6660_REG_SYSTEM_CTRL (0x03)
  1301.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement