Commit 523773b9 authored by Karol Trzcinski's avatar Karol Trzcinski Committed by Mark Brown

ASoC: SOF: loader: Adjust validation condition for fw_offset

Condition in if statement should be same as trace message
and FW size equal to zero (after skipping offset) should
be marked as invalid.
Signed-off-by: default avatarKarol Trzcinski <karolx.trzcinski@linux.intel.com>
Signed-off-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: default avatarGuennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20200520165911.21696-2-kai.vehmanen@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 29c859df
......@@ -293,7 +293,7 @@ int hda_dsp_cl_boot_firmware(struct snd_sof_dev *sdev)
chip_info = desc->chip_info;
if (plat_data->fw->size < plat_data->fw_offset) {
if (plat_data->fw->size <= plat_data->fw_offset) {
dev_err(sdev->dev, "error: firmware size must be greater than firmware offset\n");
return -EINVAL;
}
......
......@@ -385,7 +385,7 @@ static int check_header(struct snd_sof_dev *sdev, const struct firmware *fw,
struct snd_sof_fw_header *header;
size_t fw_size = fw->size - fw_offset;
if (fw->size < fw_offset) {
if (fw->size <= fw_offset) {
dev_err(sdev->dev, "error: firmware size must be greater than firmware offset\n");
return -EINVAL;
}
......
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