[1/5] ASoC: SOF: loader: Adjust validation condition for fw_offset
diff mbox series

Message ID 20200520165911.21696-2-kai.vehmanen@linux.intel.com
State Accepted
Commit 523773b9ea9f430810332aa117ea48f8feafce9a
Headers show
Series
  • ASoC: SOF: extended manifest support for 5.8
Related show

Commit Message

Kai Vehmanen May 20, 2020, 4:59 p.m. UTC
From: Karol Trzcinski <karolx.trzcinski@linux.intel.com>

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: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
---
 sound/soc/sof/intel/hda-loader.c | 2 +-
 sound/soc/sof/loader.c           | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/sound/soc/sof/intel/hda-loader.c b/sound/soc/sof/intel/hda-loader.c
index d762b3e1ce4a..441d05cda604 100644
--- a/sound/soc/sof/intel/hda-loader.c
+++ b/sound/soc/sof/intel/hda-loader.c
@@ -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;
 	}
diff --git a/sound/soc/sof/loader.c b/sound/soc/sof/loader.c
index 4a5b57ecf359..eed3d1e65685 100644
--- a/sound/soc/sof/loader.c
+++ b/sound/soc/sof/loader.c
@@ -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;
 	}