mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 21:59:12 -04:00
Merge "dsp: Fix a memory leak issue when nvmem read returns invalid length"
This commit is contained in:
commit
b6aaedd76e
1 changed files with 7 additions and 1 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue