summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKees Cook <kees@outflux.net>2023-02-23 17:12:21 -0800
committerKees Cook <kees@outflux.net>2023-03-02 11:03:42 -0800
commit8409bb869a1790f6e02391c3f0eaf9c5fa63e33f (patch)
treeeeffe58f7e07303fcffb8f0d1517e0c8257e93d2
parente73b227e8e475c20cc394f237ea35d592fdf9ec3 (diff)
downloadacpica-8409bb869a1790f6e02391c3f0eaf9c5fa63e33f.tar.gz
ACPI_RESOURCE_DMA: Replace 1-element array with flexible array
Similar to commit 7ba2f3d91a32 ("Replace one-element array with flexible-array"), replace the 1-element array with a proper flexible array member as defined by C99, but without changing the structure size. This allows the code to operate without tripping compile-time and run-time bounds checkers (e.g. via __builtin_object_size(), -fsanitize=bounds, and/or -fstrict-flex-arrays=3). As with IRQs, leave a single element in a union. No binary changes appear in the .text nor .data sections.
-rw-r--r--source/include/acrestyp.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/source/include/acrestyp.h b/source/include/acrestyp.h
index 16356098f..252cebc1b 100644
--- a/source/include/acrestyp.h
+++ b/source/include/acrestyp.h
@@ -300,7 +300,10 @@ typedef struct acpi_resource_dma
UINT8 BusMaster;
UINT8 Transfer;
UINT8 ChannelCount;
- UINT8 Channels[1];
+ union {
+ UINT8 Channel;
+ ACPI_FLEX_ARRAY(UINT8, Channels);
+ };
} ACPI_RESOURCE_DMA;