acpi: Replace struct acpi_table_slit 1-element array with flex-array

Message ID 20230523161815.3083-1-wyes.karny@amd.com
State New
Headers
Series acpi: Replace struct acpi_table_slit 1-element array with flex-array |

Commit Message

Wyes Karny May 23, 2023, 4:18 p.m. UTC
  struct acpi_table_slit is used for copying System Locality Information
Table data from ACPI tables. Here `entry` is a flex array but it was
using ancient 1-element fake flexible array, which has been deprecated.
Replace it with a C99 flexible array.

Signed-off-by: Wyes Karny <wyes.karny@amd.com>
---
 include/acpi/actbl3.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Kees Cook May 23, 2023, 4:44 p.m. UTC | #1
On Tue, May 23, 2023 at 04:18:15PM +0000, Wyes Karny wrote:
> struct acpi_table_slit is used for copying System Locality Information
> Table data from ACPI tables. Here `entry` is a flex array but it was
> using ancient 1-element fake flexible array, which has been deprecated.
> Replace it with a C99 flexible array.
> 
> Signed-off-by: Wyes Karny <wyes.karny@amd.com>

Eek, thanks. I missed one! :)

Reviewed-by: Kees Cook <keescook@chromium.org>
  
Kees Cook June 1, 2023, 4:56 p.m. UTC | #2
On Tue, 23 May 2023 16:18:15 +0000, Wyes Karny wrote:
> struct acpi_table_slit is used for copying System Locality Information
> Table data from ACPI tables. Here `entry` is a flex array but it was
> using ancient 1-element fake flexible array, which has been deprecated.
> Replace it with a C99 flexible array.
> 
> 

Since this is a fix for -fstrict-flex-arrays=3, I can carry this in the
hardening tree until it shows up in upstream ACPICA.

Applied to for-next/hardening, thanks!

[1/1] acpi: Replace struct acpi_table_slit 1-element array with flex-array
      https://git.kernel.org/kees/c/0233ca593eba
  
Rafael J. Wysocki June 1, 2023, 6:21 p.m. UTC | #3
On Thu, Jun 1, 2023 at 6:57 PM Kees Cook <keescook@chromium.org> wrote:
>
> On Tue, 23 May 2023 16:18:15 +0000, Wyes Karny wrote:
> > struct acpi_table_slit is used for copying System Locality Information
> > Table data from ACPI tables. Here `entry` is a flex array but it was
> > using ancient 1-element fake flexible array, which has been deprecated.
> > Replace it with a C99 flexible array.
> >
> >
>
> Since this is a fix for -fstrict-flex-arrays=3, I can carry this in the
> hardening tree until it shows up in upstream ACPICA.
>
> Applied to for-next/hardening, thanks!
>
> [1/1] acpi: Replace struct acpi_table_slit 1-element array with flex-array
>       https://git.kernel.org/kees/c/0233ca593eba

Works for me, thanks!
  

Patch

diff --git a/include/acpi/actbl3.h b/include/acpi/actbl3.h
index f51c46f4e3e4..000764ab3985 100644
--- a/include/acpi/actbl3.h
+++ b/include/acpi/actbl3.h
@@ -86,7 +86,7 @@  struct acpi_table_slic {
 struct acpi_table_slit {
 	struct acpi_table_header header;	/* Common ACPI table header */
 	u64 locality_count;
-	u8 entry[1];		/* Real size = localities^2 */
+	u8 entry[];				/* Real size = localities^2 */
 };
 
 /*******************************************************************************