]> www.infradead.org Git - users/jedix/linux-maple.git/commit
firmware: cs_dsp: test_bin_error: Fix uninitialized data used as fw version
authorRichard Fitzgerald <rf@opensource.cirrus.com>
Thu, 10 Apr 2025 13:21:29 +0000 (14:21 +0100)
committerMark Brown <broonie@kernel.org>
Thu, 10 Apr 2025 13:47:14 +0000 (14:47 +0100)
commit285b2c74cf9982e873ef82a2cb1328d9e9406f65
tree275e9cd417f6d4d5099dea52194ea96882636a3b
parent6bbb2b1286f437b45ccf4828a537429153cd1096
firmware: cs_dsp: test_bin_error: Fix uninitialized data used as fw version

Call cs_dsp_mock_xm_header_get_fw_version() to get the firmware version
from the dummy XM header data in cs_dsp_bin_err_test_common_init().

Make the same change to cs_dsp_bin_test_common_init() and remove the
cs_dsp_mock_xm_header_get_fw_version_from_regmap() function.

The code in cs_dsp_test_bin.c was correctly calling
cs_dsp_mock_xm_header_get_fw_version_from_regmap() to fetch the fw version
from a dummy header it wrote to XM registers. However in
cs_dsp_test_bin_error.c the test doesn't stuff a dummy header into XM, it
populates it the normal way using a wmfw file. It should have called
cs_dsp_mock_xm_header_get_fw_version() to get the data from its blob
buffer, but was calling cs_dsp_mock_xm_header_get_fw_version_from_regmap().
As nothing had been written to the registers this returned the value of
uninitialized data.

The only other use of cs_dsp_mock_xm_header_get_fw_version_from_regmap()
was cs_dsp_test_bin.c, but it doesn't need to use it. It already has a
blob buffer containing the dummy XM header so it can use
cs_dsp_mock_xm_header_get_fw_version() to read from that.

Fixes: cd8c058499b6 ("firmware: cs_dsp: Add KUnit testing of bin error cases")
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://patch.msgid.link/20250410132129.1312541-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/firmware/cirrus/test/cs_dsp_mock_mem_maps.c
drivers/firmware/cirrus/test/cs_dsp_test_bin.c
drivers/firmware/cirrus/test/cs_dsp_test_bin_error.c
include/linux/firmware/cirrus/cs_dsp_test_utils.h