Skip to contentSkip to conversation

Patch "x86/mpx/selftests: Fix up weird arrays" has been added to the 4.14-stable tree

PATCH [email protected] 1 participant 1 message Dec 12, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

x86/mpx/selftests: Fix up weird arrays

to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
x86-mpx-selftests-fix-up-weird-arrays.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Tue Dec 12 10:32:42 CET 2017

From: Dave Hansen <[email protected]>
Date: Fri, 10 Nov 2017 16:12:29 -0800
Subject: x86/mpx/selftests: Fix up weird arrays

From: Dave Hansen <[email protected]>

[ Upstream commit a6400120d042397675fcf694060779d21e9e762d ]

The MPX hardware data structurse are defined in a weird way: they define their size in bytes and then union that with the type with which we want to access them.

Yes, this is weird, but it does work. But, new GCC's complain that we are accessing the array out of bounds. Just make it a zero-sized array so gcc will stop complaining. There was not really a bug here.

---
 tools/testing/selftests/x86/mpx-hw.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/x86/mpx-hw.h +2 -2
@@ -52,14 +52,14 @@
 struct mpx_bd_entry {
 	union {
 		char x[MPX_BOUNDS_DIR_ENTRY_SIZE_BYTES];
-		void *contents[1];
+		void *contents[0];
 	};
 } __attribute__((packed));
 
 struct mpx_bt_entry {
 	union {
 		char x[MPX_BOUNDS_TABLE_ENTRY_SIZE_BYTES];
-		unsigned long contents[1];
+		unsigned long contents[0];
 	};
 } __attribute__((packed));
 

Patches currently in stable-queue which might be from [email protected] are

queue-4.14/x86-mpx-selftests-fix-up-weird-arrays.patch queue-4.14/x86-pci-make-broadcom_postcore_init-check-acpi_disabled.patch