]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ASoC: aw88395: use struct_size() and __counted_by() for aw_container
authorRosen Penev <rosenp@gmail.com>
Sat, 23 May 2026 01:17:49 +0000 (18:17 -0700)
committerMark Brown <broonie@kernel.org>
Mon, 1 Jun 2026 14:59:15 +0000 (15:59 +0100)
commit36cf16513f9dfc6dc5eee7ed5ca5fd4f649e1f1a
tree7c67b380fb1e2e8823564947e8c9bb499a7768ee
parent3a129981440fbba4ce0219069fdf257fa2fbc2ab
ASoC: aw88395: use struct_size() and __counted_by() for aw_container

The firmware container allocations passed cont->size + sizeof(int) to
kzalloc(), which was wrong: the struct contains an int len followed by a
u8 data[] flexible array. It ended up being the same as the struct's
size is only the int member but still wrong.

Use the modern struct_size helper for this.

Add __counted_by for extra runtime analysis.

Assisted-by: Claude:Opus-4.7
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://patch.msgid.link/20260523011749.101555-1-rosenp@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/aw88081.c
sound/soc/codecs/aw88261.c
sound/soc/codecs/aw88395/aw88395.c
sound/soc/codecs/aw88395/aw88395_device.h