ASoC: cs-amp-lib: Annotate struct cirrus_amp_efi_data with __counted_by()
Subsystems (3)
PATCH 1/1 ASoC: cs-amp-lib: Annotate struct cirrus_amp_efi_data with __counted_by()
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.
--- include/sound/cs-amp-lib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/sound/cs-amp-lib.h +1 -1
@@ -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;/**
Signature · 1 line
2.49.0
Quoted 16 lines · Thorsten Blum
Add the
__counted_by()compiler attribute to the flexible array member 'data' to improve access bounds-checking viaCONFIG_UBSAN_BOUNDSandCONFIG_FORTIFY_SOURCE.No functional changes intended.
Signed-off-by Thorsten Blum <[email protected]>--- include/sound/cs-amp-lib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/sound/cs-amp-lib.h +0
-0
include/sound/cs-amp-lib.h struct cirrus_amp_cal_data { · line 29
Quoted 8 lines
include/sound/cs-amp-lib.h +1
-1@@ -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;/**
I wrote a patch to do exactly the same, but you got your patch out first! It is identical to my patch so:
(Note that I did some testing with Clang-19 and the __counted_by() seems to only be checked in certain functions, like memcpy() and memset(). The get_random_bytes() used in the KUnit test can overrun the array without triggering any warning.)
Mark Brown
maintainerQuoted 3 lines · Thorsten Blum
Add the
__counted_by()compiler attribute to the flexible array member 'data' to improve access bounds-checking viaCONFIG_UBSAN_BOUNDSandCONFIG_FORTIFY_SOURCE.
As documented in submitting-patches.rst please send patches to the maintainers for the code you would like to change. The normal kernel workflow is that people apply patches from their inboxes, if they aren't copied they are likely to not see the patch at all and it is much more difficult to apply patches.
Quoted 10 lines · Mark Brown
Quoted 3 lines · Thorsten Blum
Add the
__counted_by()compiler attribute to the flexible array member 'data' to improve access bounds-checking viaCONFIG_UBSAN_BOUNDSandCONFIG_FORTIFY_SOURCE.As documented in
submitting-patches.rstplease send patches to the maintainers for the code you would like to change. The normal kernel workflow is that people apply patches from their inboxes, if they aren't copied they are likely to not see the patch at all and it is much more difficult to apply patches.
I just use whatever scripts/get_maintainer.pl outputs. Maybe the MAINTAINERS file should be updated?
Best,
Thorsten
Richard Fitzgerald
maintainerQuoted 12 lines · Thorsten Blum
Quoted 10 lines · Mark Brown
Quoted 3 lines · Thorsten Blum
Add the
__counted_by()compiler attribute to the flexible array member 'data' to improve access bounds-checking viaCONFIG_UBSAN_BOUNDSandCONFIG_FORTIFY_SOURCE.As documented in
submitting-patches.rstplease send patches to the maintainers for the code you would like to change. The normal kernel workflow is that people apply patches from their inboxes, if they aren't copied they are likely to not see the patch at all and it is much more difficult to apply patches.
Quoted 6 lines
I just use whatever
scripts/get_maintainer.ploutputs. Maybe theMAINTAINERSfile should be updated?Best,
Thorsten
MAINTAINERS only lists Takashi and Jaroslav as maintainers of include/sound/*.
A separate section lists Mark as maintainer of a specific set of files within include/sound/
I guess any files we put in include/sound that are for an ASoC driver have to also be added to Mark's ASoC section of MAINTAINERS?
Quoted 21 lines · Richard Fitzgerald
Quoted 12 lines · Thorsten Blum
Quoted 10 lines · Mark Brown
Quoted 3 lines · Thorsten Blum
Add the
__counted_by()compiler attribute to the flexible array member 'data' to improve access bounds-checking viaCONFIG_UBSAN_BOUNDSandCONFIG_FORTIFY_SOURCE.As documented in
submitting-patches.rstplease send patches to the maintainers for the code you would like to change. The normal kernel workflow is that people apply patches from their inboxes, if they aren't copied they are likely to not see the patch at all and it is much more difficult to apply patches.Quoted 6 lines
I just use whatever
scripts/get_maintainer.ploutputs. Maybe theMAINTAINERSfile should be updated?Best,
Thorsten
Quoted 8 lines
MAINTAINERSonly lists Takashi and Jaroslav as maintainers ofinclude/sound/*.A separate section lists Mark as maintainer of a specific set of files within
include/sound/I guess any files we put in
include/soundthat are for an ASoC driver have to also be added to Mark's ASoC section ofMAINTAINERS?
Yes, it makes sense.
Takashi
Mark Brown
maintainerQuoted 8 lines · Thorsten Blum
Add the
__counted_by()compiler attribute to the flexible array member 'data' to improve access bounds-checking viaCONFIG_UBSAN_BOUNDSandCONFIG_FORTIFY_SOURCE.No functional changes intended.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: cs-amp-lib: Annotate struct cirrus_amp_efi_data with __counted_by()
commit: fcdf212fd9b36c299d90229e9546c077db2215ce
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark