Commit 8c9aeaf8 authored by Devyn Liu's avatar Devyn Liu Committed by Hao Chen
Browse files

spi: Add verification for the max_frequency provided by the firmware

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


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 avatarJunhua Lu <lujunhua7@h-partners.com>
parent dcde7354
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)