Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH] ASoC: cs-amp-lib: Annotate struct cirrus_amp_efi_data with __counted_by()
@ 2025-04-15  9:03 Thorsten Blum
  2025-04-15  9:24 ` Richard Fitzgerald
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Thorsten Blum @ 2025-04-15  9:03 UTC (permalink / raw)
  To: David Rhodes, Richard Fitzgerald, Jaroslav Kysela, Takashi Iwai,
	Kees Cook, Gustavo A. R. Silva
  Cc: Thorsten Blum, linux-sound, patches, linux-kernel,
	linux-hardening

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@linux.dev>
---
 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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-04-15 14:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-15  9:03 [PATCH] ASoC: cs-amp-lib: Annotate struct cirrus_amp_efi_data with __counted_by() Thorsten Blum
2025-04-15  9:24 ` Richard Fitzgerald
2025-04-15 10:56 ` Mark Brown
2025-04-15 11:51   ` Thorsten Blum
2025-04-15 12:03     ` Richard Fitzgerald
2025-04-15 12:07       ` Takashi Iwai
2025-04-15 14:36 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox