summaryrefslogtreecommitdiff
path: root/drivers/firmware/cirrus/test/cs_dsp_mock_bin.c
AgeCommit message (Collapse)Author
2025-05-23firmware: cs_dsp: Fix OOB memory read access in KUnit testJaroslav Kysela
KASAN reported out of bounds access - cs_dsp_mock_bin_add_name_or_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> Link: https://patch.msgid.link/20250523102102.1177151-1-perex@perex.cz Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-16firmware: cs_dsp: Add some sanity-checking to test harnessRichard Fitzgerald
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>
2024-12-16firmware: cs_dsp: Fix kerneldoc typos in cs_dsp_mock_bin.cRichard Fitzgerald
Fix two places in kerneldoc where alg_id had been mistyped as alg_ig. Fixes: 7c052c661529 ("firmware: cs_dsp: Add mock bin file generator for KUnit testing") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202412142205.HHHcousT-lkp@intel.com/ Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20241216105520.22135-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-12-13firmware: cs_dsp: Add mock bin file generator for KUnit testingRichard Fitzgerald
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 bin file. The data payload in a bin is an opaque blob, so the mock bin only needs to generate the appropriate file header and description block for each payload blob. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20241212143725.1381013-5-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>