Commit 279e17ae authored by Christian Engelmayer's avatar Christian Engelmayer Committed by Mark Brown

ASoC: Intel: sst: Fix firmware name size handling

Function sst_acpi_probe() uses plain strcpy for setting member firmware_name
of a struct intel_sst_drv from member firmware of a struct sst_machines.
Thereby the destination array has got a length of 20 byte while the source may
hold 32 byte. Since eg. commit 64b9c90b ("ASoC: Intel: Fix BYTCR firmware
name") increased strings from "fw_sst_0f28.bin" to "intel/fw_sst_0f28.bin"
there is an actual possibility that the 20 byte array at the end of struct
intel_sst_drv is overrun.

Thus increase the size of the destination and use the same define for both
structs. Detected by Coverity CID 1260087.
Signed-off-by: default avatarChristian Engelmayer <cengelma@gmx.at>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
parent 5c2b0636
...@@ -58,6 +58,7 @@ enum sst_algo_ops { ...@@ -58,6 +58,7 @@ enum sst_algo_ops {
#define SST_BLOCK_TIMEOUT 1000 #define SST_BLOCK_TIMEOUT 1000
#define FW_SIGNATURE_SIZE 4 #define FW_SIGNATURE_SIZE 4
#define FW_NAME_SIZE 32
/* stream states */ /* stream states */
enum sst_stream_states { enum sst_stream_states {
...@@ -426,7 +427,7 @@ struct intel_sst_drv { ...@@ -426,7 +427,7 @@ struct intel_sst_drv {
* Holder for firmware name. Due to async call it needs to be * Holder for firmware name. Due to async call it needs to be
* persistent till worker thread gets called * persistent till worker thread gets called
*/ */
char firmware_name[20]; char firmware_name[FW_NAME_SIZE];
}; };
/* misc definitions */ /* misc definitions */
......
...@@ -47,7 +47,7 @@ struct sst_machines { ...@@ -47,7 +47,7 @@ struct sst_machines {
char board[32]; char board[32];
char machine[32]; char machine[32];
void (*machine_quirk)(void); void (*machine_quirk)(void);
char firmware[32]; char firmware[FW_NAME_SIZE];
struct sst_platform_info *pdata; struct sst_platform_info *pdata;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment