android_kernel_samsung_sm8650/include
Linus Torvalds 47f15561b6 drm: fix EDID struct for old ARM OABI format
When building the kernel for arm with the "-mabi=apcs-gnu" option, gcc
will force alignment of all structures and unions to a word boundary
(see also STRUCTURE_SIZE_BOUNDARY and the "-mstructure-size-boundary=XX"
option if you're a gcc person), even when the members of said structures
do not want or need said alignment.

This completely messes up the structure alignment of 'struct edid' on
those targets, because even though all the embedded structures are
marked with "__attribute__((packed))", the unions that contain them are
not.

This was exposed by commit f1e4c916f9 ("drm/edid: add EDID block count
and size helpers"), but the bug is pre-existing.  That commit just made
the structure layout problem cause a build failure due to the addition
of the

        BUILD_BUG_ON(sizeof(*edid) != EDID_LENGTH);

sanity check in drivers/gpu/drm/drm_edid.c:edid_block_data().

This legacy union alignment should probably not be used in the first
place, but we can fix the layout by adding the packed attribute to the
union entries even when each member is already packed and it shouldn't
matter in a sane build environment.

You can see this issue with a trivial test program:

  union {
	struct {
		char c[5];
	};
	struct {
		char d;
		unsigned e;
	} __attribute__((packed));
  } a = { "1234" };

where building this with a normal "gcc -S" will result in the expected
5-byte size of said union:

	.type	a, @object
	.size	a, 5

but with an ARM compiler and the old ABI:

    arm-linux-gnu-gcc -mabi=apcs-gnu -mfloat-abi=soft -S t.c

you get

	.type	a, %object
	.size	a, 8

instead, because even though each member of the union is packed, the
union itself still gets aligned.

This was reported by Sudip for the spear3xx_defconfig target.

Link: https://lore.kernel.org/lkml/YpCUzStDnSgQLNFN@debian/
Reported-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-05-28 13:06:49 -07:00
..
acpi cxl for 5.19 2022-05-27 21:24:19 -07:00
asm-generic Yang Shi has improved the behaviour of khugepaged collapsing of readonly 2022-05-26 12:32:41 -07:00
clocksource
crypto
drm drm: fix EDID struct for old ARM OABI format 2022-05-28 13:06:49 -07:00
dt-bindings Pin control bulk changes for the v5.19 series: 2022-05-28 11:15:54 -07:00
keys KEYS: trusted: Introduce support for NXP CAAM-based trusted keys 2022-05-23 18:47:50 +03:00
kunit kunit: take kunit_assert as const 2022-05-16 13:23:00 -06:00
kvm Merge branch kvm-arm64/per-vcpu-host-pmu-data into kvmarm-master/next 2022-05-16 17:48:36 +01:00
linux hyperv-next for 5.19 2022-05-28 11:39:01 -07:00
math-emu
media media: h264: Sort p/b reflist using frame_num 2022-05-17 10:02:29 +02:00
memory memory: renesas-rpc-if: Fix HF/OSPI data transfer in Manual Mode 2022-04-21 17:00:24 +02:00
misc
net Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2022-05-23 16:07:14 -07:00
pcmcia
ras Revert "mm/memory-failure.c: fix race with changing page compound again" 2022-04-28 23:16:02 -07:00
rdma RDMA/core: Fix typo in comment 2022-05-24 11:24:58 -03:00
scsi SCSI misc on 20220524 2022-05-25 19:09:48 -07:00
soc ARM: driver changes for 5.19 2022-05-26 10:32:47 -07:00
sound ASoC: Updates for v5.19 2022-05-23 16:03:04 +02:00
target SCSI misc on 20220524 2022-05-25 19:09:48 -07:00
trace NFSD 5.19 Release Notes 2022-05-26 20:52:24 -07:00
uapi cxl for 5.19 2022-05-27 21:24:19 -07:00
vdso
video
xen dma-mapping updates for Linux 5.19 2022-05-25 19:18:36 -07:00