diff options
author | Sakari Ailus <sakari.ailus@iki.fi> | 2016-03-03 12:20:14 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-03-03 16:10:53 -0500 |
commit | fbe093ac9f0201939279cdfe8b0fce20ce5ef7a9 (patch) | |
tree | c1013fbe8e968d678d26867e7cef9279a42e816a | |
parent | 93125094c07d8c9ec25dff5869f191b33eb9dd6e (diff) |
[media] media: Sanitise the reserved fields of the G_TOPOLOGY IOCTL arguments
The argument structs are used in arrays for G_TOPOLOGY IOCTL. The
arguments themselves do not need to be aligned to a power of two, but
aligning them up to the largest basic type alignment (u64) on common ABIs
is a good thing to do.
The patch changes the size of the reserved fields to 5 or 6 u32's and
aligns the size of the struct to 8 bytes so we do no longer depend on the
compiler to perform the alignment.
While at it, add __attribute__ ((packed)) to these structs as well.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r-- | include/uapi/linux/media.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h index 323f1af35062..625b38f65764 100644 --- a/include/uapi/linux/media.h +++ b/include/uapi/linux/media.h | |||
@@ -297,14 +297,14 @@ struct media_v2_entity { | |||
297 | __u32 id; | 297 | __u32 id; |
298 | char name[64]; /* FIXME: move to a property? (RFC says so) */ | 298 | char name[64]; /* FIXME: move to a property? (RFC says so) */ |
299 | __u32 function; /* Main function of the entity */ | 299 | __u32 function; /* Main function of the entity */ |
300 | __u16 reserved[12]; | 300 | __u32 reserved[6]; |
301 | }; | 301 | } __attribute__ ((packed)); |
302 | 302 | ||
303 | /* Should match the specific fields at media_intf_devnode */ | 303 | /* Should match the specific fields at media_intf_devnode */ |
304 | struct media_v2_intf_devnode { | 304 | struct media_v2_intf_devnode { |
305 | __u32 major; | 305 | __u32 major; |
306 | __u32 minor; | 306 | __u32 minor; |
307 | }; | 307 | } __attribute__ ((packed)); |
308 | 308 | ||
309 | struct media_v2_interface { | 309 | struct media_v2_interface { |
310 | __u32 id; | 310 | __u32 id; |
@@ -316,22 +316,22 @@ struct media_v2_interface { | |||
316 | struct media_v2_intf_devnode devnode; | 316 | struct media_v2_intf_devnode devnode; |
317 | __u32 raw[16]; | 317 | __u32 raw[16]; |
318 | }; | 318 | }; |
319 | }; | 319 | } __attribute__ ((packed)); |
320 | 320 | ||
321 | struct media_v2_pad { | 321 | struct media_v2_pad { |
322 | __u32 id; | 322 | __u32 id; |
323 | __u32 entity_id; | 323 | __u32 entity_id; |
324 | __u32 flags; | 324 | __u32 flags; |
325 | __u16 reserved[9]; | 325 | __u32 reserved[5]; |
326 | }; | 326 | } __attribute__ ((packed)); |
327 | 327 | ||
328 | struct media_v2_link { | 328 | struct media_v2_link { |
329 | __u32 id; | 329 | __u32 id; |
330 | __u32 source_id; | 330 | __u32 source_id; |
331 | __u32 sink_id; | 331 | __u32 sink_id; |
332 | __u32 flags; | 332 | __u32 flags; |
333 | __u32 reserved[5]; | 333 | __u32 reserved[6]; |
334 | }; | 334 | } __attribute__ ((packed)); |
335 | 335 | ||
336 | struct media_v2_topology { | 336 | struct media_v2_topology { |
337 | __u64 topology_version; | 337 | __u64 topology_version; |
@@ -351,7 +351,7 @@ struct media_v2_topology { | |||
351 | __u32 num_links; | 351 | __u32 num_links; |
352 | __u32 reserved4; | 352 | __u32 reserved4; |
353 | __u64 ptr_links; | 353 | __u64 ptr_links; |
354 | }; | 354 | } __attribute__ ((packed)); |
355 | 355 | ||
356 | static inline void __user *media_get_uptr(__u64 arg) | 356 | static inline void __user *media_get_uptr(__u64 arg) |
357 | { | 357 | { |