[PATCH] ASoC: cs-amp-lib: Annotate struct cirrus_amp_efi_data with __counted_by()

From: Thorsten Blum
Date: Tue Apr 15 2025 - 05:04:48 EST


Add the __counted_by() compiler attribute to the flexible array member
'data' to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
CONFIG_FORTIFY_SOURCE.

No functional changes intended.

Signed-off-by: Thorsten Blum <thorsten.blum@xxxxxxxxx>
---
include/sound/cs-amp-lib.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/sound/cs-amp-lib.h b/include/sound/cs-amp-lib.h
index f481148735e1..5459c221badf 100644
--- a/include/sound/cs-amp-lib.h
+++ b/include/sound/cs-amp-lib.h
@@ -23,7 +23,7 @@ struct cirrus_amp_cal_data {
struct cirrus_amp_efi_data {
u32 size;
u32 count;
- struct cirrus_amp_cal_data data[];
+ struct cirrus_amp_cal_data data[] __counted_by(count);
} __packed;

/**
--
2.49.0