History

media: dvb: Fix dtvs_stats packing.

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

Ricardo Ribalda committed 2 years ago

Commit 2abcd951 parent 309422d1 file · +1 −1Browse files

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

Unified · Split

include/uapi/linux/dvb/frontend.h+1−1
@@ -854,7 +854,7 @@ struct dtv_stats { · 853 unmodified lines
854854 union {
855855 __u64 uvalue; /* for counters and relative scales */
856856 __s64 svalue; /* for 0.001 dB measures */
857− };
857+ } __attribute__ ((packed));
858858 } __attribute__ ((packed));
859859
860860