]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
media: dvb: Fix dtvs_stats packing.
authorRicardo Ribalda <ribalda@chromium.org>
Wed, 10 Apr 2024 12:24:38 +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/dvb/frontend.h:854:2: warning: field  within 'struct dtv_stats' is less aligned than 'union dtv_stats::(anonymous at ./include/uapi/linux/dvb/frontend.h:854:2)' and is usually due to 'struct dtv_stats' 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/dvb/frontend.h

index 7e0983b987c2d95c1c2b3b0972ed5c10105ee174..8d38c6befda8d0871845579ac3d5f030a9d9aaa2 100644 (file)
@@ -854,7 +854,7 @@ struct dtv_stats {
        union {
                __u64 uvalue;   /* for counters and relative scales */
                __s64 svalue;   /* for 0.001 dB measures */
-       };
+       }  __attribute__ ((packed));
 } __attribute__ ((packed));