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>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20200520165911.21696-2-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
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;
}
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;
}