History

media: videodev2: Fix v4l2_ext_control packing.

The structure is packed, which requires that all its fields need to be also packed. ./include/uapi/linux/videodev2.h:1810:2: warning: field within 'struct v4l2_ext_control' is less aligned than 'union v4l2_ext_control::(anonymous at ./include/uapi/linux/videodev2.h:1810:2)' and is usually due to 'struct v4l2_ext_control' being packed, which can lead to unaligned accesses [-Wunaligned-access] Explicitly set the inner union as packed. Marking the inner union as 'packed' does not change the layout, since the whole struct is already packed, it just silences the clang warning. See also this llvm discussion: https://github.com/llvm/llvm-project/issues/55520

Ricardo Ribalda committed 2 years ago

Commit 81741e81 parent 2abcd951 file · +1 −1Browse files

Showing the changes to include/uapi (1 of 1 file). Show all

Unified · Split

include/uapi/linux/videodev2.h+1−1
@@ -1842,7 +1842,7 @@ struct v4l2_ext_control { · 1841 unmodified lines
18421842 struct v4l2_ctrl_hdr10_cll_info __user *p_hdr10_cll_info;
18431843 struct v4l2_ctrl_hdr10_mastering_display __user *p_hdr10_mastering_display;
18441844 void __user *ptr;
1845− };
1845+ } __attribute__ ((packed));
18461846 } __attribute__ ((packed));
18471847
18481848 struct v4l2_ext_controls {