]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
media: videodev2: Fix v4l2_ext_control packing.
authorRicardo Ribalda <ribalda@chromium.org>
Wed, 10 Apr 2024 12:24:39 +0000 (12:24 +0000)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Mon, 15 Apr 2024 11:42:38 +0000 (13:42 +0200)
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

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
include/uapi/linux/videodev2.h

index 2663213b76a492350c792fe90433a6c6650eea47..bf12860d570af6934545da4e6096c053532889a5 100644 (file)
@@ -1842,7 +1842,7 @@ struct v4l2_ext_control {
                struct v4l2_ctrl_hdr10_cll_info __user *p_hdr10_cll_info;
                struct v4l2_ctrl_hdr10_mastering_display __user *p_hdr10_mastering_display;
                void __user *ptr;
-       };
+       } __attribute__ ((packed));
 } __attribute__ ((packed));
 
 struct v4l2_ext_controls {