From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754778AbdKKAMu (ORCPT ); Fri, 10 Nov 2017 19:12:50 -0500 Received: from mga02.intel.com ([134.134.136.20]:50938 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754387AbdKKAMt (ORCPT ); Fri, 10 Nov 2017 19:12:49 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,377,1505804400"; d="scan'208";a="148442315" Subject: [PATCH 2/4] x86, selftests, mpx: fix up weird arrays To: linux-kernel@vger.kernel.org Cc: x86@kernel.org, Dave Hansen From: Dave Hansen Date: Fri, 10 Nov 2017 16:12:29 -0800 References: <20171111001226.810E7A73@viggo.jf.intel.com> In-Reply-To: <20171111001226.810E7A73@viggo.jf.intel.com> Message-Id: <20171111001229.58A7933D@viggo.jf.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. --- b/tools/testing/selftests/x86/mpx-hw.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff -puN tools/testing/selftests/x86/mpx-hw.h~x86-selftests-mpx-weird-arrays tools/testing/selftests/x86/mpx-hw.h --- a/tools/testing/selftests/x86/mpx-hw.h~x86-selftests-mpx-weird-arrays 2017-11-10 15:29:24.846207949 -0800 +++ b/tools/testing/selftests/x86/mpx-hw.h 2017-11-10 15:29:24.850207949 -0800 @@ -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)); _