Jaroslav Kysela
d979b783d6
firmware: cs_dsp: Fix OOB memory read access in KUnit test (wmfw info)
...
KASAN reported out of bounds access - cs_dsp_mock_wmfw_add_info(),
because the source string length was rounded up to the allocation size.
Cc: Simon Trimmer <simont@opensource.cirrus.com >
Cc: Charles Keepax <ckeepax@opensource.cirrus.com >
Cc: Richard Fitzgerald <rf@opensource.cirrus.com >
Cc: patches@opensource.cirrus.com
Cc: stable@vger.kernel.org
Signed-off-by: Jaroslav Kysela <perex@perex.cz >
Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com >
Link: https://patch.msgid.link/20250523155814.1256762-1-perex@perex.cz
Signed-off-by: Mark Brown <broonie@kernel.org >
2025-05-26 11:33:51 +01:00
Richard Fitzgerald
4308487b29
firmware: cs_dsp: Add some sanity-checking to test harness
...
Add sanity checking to some test harness functions to help catch bugs
in the test code. This consists of checking the range of some arguments
and checking that reads from the dummy regmap succeed.
Most of the harness code already had sanity-checking but there were a
few places where it was missing or was assumed that the test could be
trusted to pass valid values.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com >
Link: https://patch.msgid.link/20250416122422.783215-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org >
2025-04-16 19:55:02 +01:00
Richard Fitzgerald
644115e860
firmware: cs_dsp: Fix endianness conversion in cs_dsp_mock_wmfw.c
...
In cs_dsp_mock_wmfw_add_coeff_desc() the value stored in longstring->len
needs a cpu_to_le16() conversion.
Fixes: 5cf1b7b471 ("firmware: cs_dsp: Add mock wmfw file generator for KUnit testing")
Reported-by: kernel test robot <lkp@intel.com >
Closes: https://lore.kernel.org/oe-kbuild-all/202412170233.8DnsdtY6-lkp@intel.com/
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com >
Link: https://patch.msgid.link/20241217105624.139479-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org >
2024-12-17 13:27:40 +00:00
Richard Fitzgerald
5cf1b7b471
firmware: cs_dsp: Add mock wmfw file generator for KUnit testing
...
Add a mock firmware file that emulates what the firmware build tools
would normally create. This will be used by KUnit tests to generate a
test wmfw file.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com >
Link: https://patch.msgid.link/20241212143725.1381013-4-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org >
2024-12-13 13:14:39 +00:00