Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f5758806 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "drivers: llcc: Add extra check for sct size during get slice call"

parents d29acc72 3374ff21
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ static struct llcc_slice_desc *llcc_slice_get_entry(struct device *dev, int n)
	const struct llcc_slice_config *llcc_data_ptr;
	struct llcc_slice_desc *desc;
	struct platform_device *pdev;
	u32 sz, count;

	if (of_parse_phandle_with_args(dev->of_node, "cache-slices",
				       "#cache-cells", n, &phargs)) {
@@ -96,14 +97,17 @@ static struct llcc_slice_desc *llcc_slice_get_entry(struct device *dev, int n)
	}

	llcc_data_ptr = drv->slice_data;
	sz = drv->llcc_config_data_sz;
	count = 0;

	while (llcc_data_ptr) {
	while (llcc_data_ptr && count < sz) {
		if (llcc_data_ptr->usecase_id == phargs.args[0])
			break;
		llcc_data_ptr++;
		count++;
	}

	if (llcc_data_ptr == NULL) {
	if (llcc_data_ptr == NULL || count == sz) {
		pr_err("can't find %d usecase id\n", phargs.args[0]);
		return ERR_PTR(-ENODEV);
	}