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

Commit b6aaedd7 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "dsp: Fix a memory leak issue when nvmem read returns invalid length"

parents c1a9199e d053d56f
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -388,10 +388,16 @@ static int adsp_loader_probe(struct platform_device *pdev)
	}
	buf = nvmem_cell_read(cell, &len);
	nvmem_cell_put(cell);
	if (IS_ERR_OR_NULL(buf) || len <= 0 || len > sizeof(u32)) {
	if (IS_ERR_OR_NULL(buf)) {
		dev_dbg(&pdev->dev, "%s: FAILED to read nvmem cell \n", __func__);
		goto wqueue;
	}
	if (len <= 0 || len > sizeof(u32)) {
		dev_dbg(&pdev->dev, "%s: nvmem cell length out of range: %d\n",
			__func__, len);
		kfree(buf);
		goto wqueue;
	}
	memcpy(&adsp_var_idx, buf, len);
	kfree(buf);