Commit d2ab6cad authored by Devyn Liu's avatar Devyn Liu Committed by hongrongxuan
Browse files

spi: Add verification for the max_frequency provided by the firmware

driver inclusion
category: cleanup
bugzilla: https://gitee.com/openeuler/kernel/issues/I9QOAJ


CVE: NA

--------------------------------

Add verification for the max_frequency provided by the firmware.
If the value is 0, the parameter is regarded as invalid and an
error code is returned.

Signed-off-by: default avatarDevyn Liu <liudingyuan@huawei.com>
Signed-off-by: default avatarhongrongxuan <hongrongxuan@huawei.com>
parent 20af5164
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -481,6 +481,12 @@ static int hisi_spi_probe(struct platform_device *pdev)
		return -EINVAL;
	}

	if (host->max_speed_hz == 0) {
		dev_err(dev, "invalid max SPI clocking speed, max-freq=%u\n",
				host->max_speed_hz);
		return -EINVAL;
	}

	ret = device_property_read_u16(dev, "num-cs",
					&host->num_chipselect);
	if (ret)