Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

authored by

Ricardo Ribalda and committed by
Hans Verkuil
2abcd952 309422d2

+1 -1
+1 -1
include/uapi/linux/dvb/frontend.h
··· 854 854 union { 855 855 __u64 uvalue; /* for counters and relative scales */ 856 856 __s64 svalue; /* for 0.001 dB measures */ 857 - }; 857 + } __attribute__ ((packed)); 858 858 } __attribute__ ((packed)); 859 859 860 860