Skip to content

Commit 9fe656e

Browse files
Jan BlunckLinus Torvalds
authored andcommitted
[PATCH] i4l: __attribute__((packed)) for the CAPI message structs
The CAPI message structs itself should be packed and not the location of single fields in the structure. Signed-off-by: Jan Blunck <jblunck@suse.de> Acked-by: Karsten Keil <kkeil@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent bfc090c commit 9fe656e

1 file changed

Lines changed: 44 additions & 44 deletions

File tree

‎drivers/isdn/act2000/capi.h‎

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -78,29 +78,29 @@ typedef union actcapi_infoel { /* info element */
7878
typedef struct actcapi_msn {
7979
__u8 eaz;
8080
__u8 len; /* Length of MSN */
81-
__u8 msn[15] __attribute__ ((packed));
82-
} actcapi_msn;
81+
__u8 msn[15];
82+
} __attribute__((packed)) actcapi_msn;
8383

8484
typedef struct actcapi_dlpd {
8585
__u8 len; /* Length of structure */
86-
__u16 dlen __attribute__ ((packed)); /* Data Length */
87-
__u8 laa __attribute__ ((packed)); /* Link Address A */
86+
__u16 dlen; /* Data Length */
87+
__u8 laa; /* Link Address A */
8888
__u8 lab; /* Link Address B */
8989
__u8 modulo; /* Modulo Mode */
9090
__u8 win; /* Window size */
9191
__u8 xid[100]; /* XID Information */
92-
} actcapi_dlpd;
92+
} __attribute__((packed)) actcapi_dlpd;
9393

9494
typedef struct actcapi_ncpd {
9595
__u8 len; /* Length of structure */
96-
__u16 lic __attribute__ ((packed));
97-
__u16 hic __attribute__ ((packed));
98-
__u16 ltc __attribute__ ((packed));
99-
__u16 htc __attribute__ ((packed));
100-
__u16 loc __attribute__ ((packed));
101-
__u16 hoc __attribute__ ((packed));
102-
__u8 modulo __attribute__ ((packed));
103-
} actcapi_ncpd;
96+
__u16 lic;
97+
__u16 hic;
98+
__u16 ltc;
99+
__u16 htc;
100+
__u16 loc;
101+
__u16 hoc;
102+
__u8 modulo;
103+
} __attribute__((packed)) actcapi_ncpd;
104104
#define actcapi_ncpi actcapi_ncpd
105105

106106
/*
@@ -168,19 +168,19 @@ typedef struct actcapi_msg {
168168
__u16 manuf_msg;
169169
__u16 controller;
170170
actcapi_msn msnmap;
171-
} manufacturer_req_msn;
171+
} __attribute ((packed)) manufacturer_req_msn;
172172
/* TODO: TraceInit-req/conf/ind/resp and
173173
* TraceDump-req/conf/ind/resp
174174
*/
175175
struct connect_req {
176176
__u8 controller;
177177
__u8 bchan;
178-
__u32 infomask __attribute__ ((packed));
178+
__u32 infomask;
179179
__u8 si1;
180180
__u8 si2;
181181
__u8 eaz;
182182
actcapi_addr addr;
183-
} connect_req;
183+
} __attribute__ ((packed)) connect_req;
184184
struct connect_conf {
185185
__u16 plci;
186186
__u16 info;
@@ -192,22 +192,22 @@ typedef struct actcapi_msg {
192192
__u8 si2;
193193
__u8 eaz;
194194
actcapi_addr addr;
195-
} connect_ind;
195+
} __attribute__ ((packed)) connect_ind;
196196
struct connect_resp {
197197
__u16 plci;
198198
__u8 rejectcause;
199199
} connect_resp;
200200
struct connect_active_ind {
201201
__u16 plci;
202202
actcapi_addr addr;
203-
} connect_active_ind;
203+
} __attribute__ ((packed)) connect_active_ind;
204204
struct connect_active_resp {
205205
__u16 plci;
206206
} connect_active_resp;
207207
struct connect_b3_req {
208208
__u16 plci;
209209
actcapi_ncpi ncpi;
210-
} connect_b3_req;
210+
} __attribute__ ((packed)) connect_b3_req;
211211
struct connect_b3_conf {
212212
__u16 plci;
213213
__u16 ncci;
@@ -217,12 +217,12 @@ typedef struct actcapi_msg {
217217
__u16 ncci;
218218
__u16 plci;
219219
actcapi_ncpi ncpi;
220-
} connect_b3_ind;
220+
} __attribute__ ((packed)) connect_b3_ind;
221221
struct connect_b3_resp {
222222
__u16 ncci;
223223
__u8 rejectcause;
224-
actcapi_ncpi ncpi __attribute__ ((packed));
225-
} connect_b3_resp;
224+
actcapi_ncpi ncpi;
225+
} __attribute__ ((packed)) connect_b3_resp;
226226
struct disconnect_req {
227227
__u16 plci;
228228
__u8 cause;
@@ -241,14 +241,14 @@ typedef struct actcapi_msg {
241241
struct connect_b3_active_ind {
242242
__u16 ncci;
243243
actcapi_ncpi ncpi;
244-
} connect_b3_active_ind;
244+
} __attribute__ ((packed)) connect_b3_active_ind;
245245
struct connect_b3_active_resp {
246246
__u16 ncci;
247247
} connect_b3_active_resp;
248248
struct disconnect_b3_req {
249249
__u16 ncci;
250250
actcapi_ncpi ncpi;
251-
} disconnect_b3_req;
251+
} __attribute__ ((packed)) disconnect_b3_req;
252252
struct disconnect_b3_conf {
253253
__u16 ncci;
254254
__u16 info;
@@ -257,15 +257,15 @@ typedef struct actcapi_msg {
257257
__u16 ncci;
258258
__u16 info;
259259
actcapi_ncpi ncpi;
260-
} disconnect_b3_ind;
260+
} __attribute__ ((packed)) disconnect_b3_ind;
261261
struct disconnect_b3_resp {
262262
__u16 ncci;
263263
} disconnect_b3_resp;
264264
struct info_ind {
265265
__u16 plci;
266266
actcapi_infonr nr;
267267
actcapi_infoel el;
268-
} info_ind;
268+
} __attribute__ ((packed)) info_ind;
269269
struct info_resp {
270270
__u16 plci;
271271
} info_resp;
@@ -279,56 +279,56 @@ typedef struct actcapi_msg {
279279
struct select_b2_protocol_req {
280280
__u16 plci;
281281
__u8 protocol;
282-
actcapi_dlpd dlpd __attribute__ ((packed));
283-
} select_b2_protocol_req;
282+
actcapi_dlpd dlpd;
283+
} __attribute__ ((packed)) select_b2_protocol_req;
284284
struct select_b2_protocol_conf {
285285
__u16 plci;
286286
__u16 info;
287287
} select_b2_protocol_conf;
288288
struct select_b3_protocol_req {
289289
__u16 plci;
290290
__u8 protocol;
291-
actcapi_ncpd ncpd __attribute__ ((packed));
292-
} select_b3_protocol_req;
291+
actcapi_ncpd ncpd;
292+
} __attribute__ ((packed)) select_b3_protocol_req;
293293
struct select_b3_protocol_conf {
294294
__u16 plci;
295295
__u16 info;
296296
} select_b3_protocol_conf;
297297
struct listen_req {
298298
__u8 controller;
299-
__u32 infomask __attribute__ ((packed));
300-
__u16 eazmask __attribute__ ((packed));
301-
__u16 simask __attribute__ ((packed));
302-
} listen_req;
299+
__u32 infomask;
300+
__u16 eazmask;
301+
__u16 simask;
302+
} __attribute__ ((packed)) listen_req;
303303
struct listen_conf {
304304
__u8 controller;
305-
__u16 info __attribute__ ((packed));
306-
} listen_conf;
305+
__u16 info;
306+
} __attribute__ ((packed)) listen_conf;
307307
struct data_b3_req {
308308
__u16 fakencci;
309309
__u16 datalen;
310310
__u32 unused;
311311
__u8 blocknr;
312-
__u16 flags __attribute__ ((packed));
313-
} data_b3_req;
312+
__u16 flags;
313+
} __attribute ((packed)) data_b3_req;
314314
struct data_b3_ind {
315315
__u16 fakencci;
316316
__u16 datalen;
317317
__u32 unused;
318318
__u8 blocknr;
319-
__u16 flags __attribute__ ((packed));
320-
} data_b3_ind;
319+
__u16 flags;
320+
} __attribute__ ((packed)) data_b3_ind;
321321
struct data_b3_resp {
322322
__u16 ncci;
323323
__u8 blocknr;
324-
} data_b3_resp;
324+
} __attribute__ ((packed)) data_b3_resp;
325325
struct data_b3_conf {
326326
__u16 ncci;
327327
__u8 blocknr;
328-
__u16 info __attribute__ ((packed));
329-
} data_b3_conf;
328+
__u16 info;
329+
} __attribute__ ((packed)) data_b3_conf;
330330
} msg;
331-
} actcapi_msg;
331+
} __attribute__ ((packed)) actcapi_msg;
332332

333333
static inline unsigned short
334334
actcapi_nextsmsg(act2000_card *card)

0 commit comments

Comments
 (0)