android_kernel_sony_sdm845/include
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Linus Torvalds 4188758b53 drm: fix EDID struct for old ARM OABI format
[ Upstream commit 47f15561b69e226bfc034e94ff6dbec51a4662af ]

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 f1e4c916f97f ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-06-14 16:52:30 +02:00
..
acpi ACPI: scan: Use unique number for instance_no 2021-03-30 14:41:41 +02:00
asm-generic hugetlbfs: flush TLBs correctly after huge_pmd_unshare 2021-12-08 08:45:03 +01:00
clocksource
crypto crypto: public_key: fix overflow during implicit conversion 2021-09-22 11:43:03 +02:00
drm drm: fix EDID struct for old ARM OABI format 2022-06-14 16:52:30 +02:00
dt-bindings dt-bindings: reset: meson8b: fix duplicate reset IDs 2020-01-23 08:19:38 +01:00
keys KEYS: user: Align the payload buffer 2019-02-27 10:07:00 +01:00
kvm arm/arm64: KVM: Add PSCI version selection API 2018-05-09 09:50:19 +02:00
linux ptrace/xtensa: Replace PT_SINGLESTEP with TIF_SINGLESTEP 2022-06-14 16:52:28 +02:00
math-emu math-emu/soft-fp.h: (_FP_ROUND_ZERO) cast 0 to void to fix warning 2019-12-21 10:41:02 +01:00
media media: v4l2-device.h: Explicitly compare grp{id,mask} to zero in v4l2_device macros 2020-02-28 15:42:24 +01:00
memory
misc
net Bluetooth: Fix the creation of hdev->name 2022-05-15 19:39:17 +02:00
pcmcia
ras
rdma IB/cma: Fix reference count leak when no ipv4 addresses are set 2020-06-03 08:16:33 +02:00
rxrpc
scsi scsi: iscsi: Add iscsi_cls_conn refcount helpers 2021-07-20 16:21:11 +02:00
soc irqchip/eznps: Fix build error for !ARC700 builds 2020-09-23 08:46:10 +02:00
sound ALSA: jack: Access input_dev under mutex 2022-06-14 16:52:28 +02:00
target scsi: target: Fix ordered tag handling 2021-11-26 11:48:41 +01:00
trace memcg: fix a crash in wb_workfn when a device disappears 2021-02-23 13:59:15 +01:00
uapi HID: add mapping for KEY_ALL_APPLICATIONS 2022-03-08 19:00:59 +01:00
video udlfb: set optimal write delay 2018-09-09 20:01:25 +02:00
xen xen/gnttab: fix gnttab_end_foreign_access() without page specified 2022-03-11 10:03:33 +01:00
Kbuild