Commit e1fce564 authored by Wang Yufen's avatar Wang Yufen Committed by Kees Cook

pstore/ram: Fix error return code in ramoops_probe()

In the if (dev_of_node(dev) && !pdata) path, the "err" may be assigned a
value of 0, so the error return code -EINVAL may be incorrectly set
to 0. To fix set valid return code before calling to goto.

Fixes: 35da6094 ("pstore/ram: add Device Tree bindings")
Signed-off-by: default avatarWang Yufen <wangyufen@huawei.com>
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/1669969374-46582-1-git-send-email-wangyufen@huawei.com
parent 38b91847
...@@ -745,6 +745,7 @@ static int ramoops_probe(struct platform_device *pdev) ...@@ -745,6 +745,7 @@ static int ramoops_probe(struct platform_device *pdev)
/* Make sure we didn't get bogus platform data pointer. */ /* Make sure we didn't get bogus platform data pointer. */
if (!pdata) { if (!pdata) {
pr_err("NULL platform data\n"); pr_err("NULL platform data\n");
err = -EINVAL;
goto fail_out; goto fail_out;
} }
...@@ -752,6 +753,7 @@ static int ramoops_probe(struct platform_device *pdev) ...@@ -752,6 +753,7 @@ static int ramoops_probe(struct platform_device *pdev)
!pdata->ftrace_size && !pdata->pmsg_size)) { !pdata->ftrace_size && !pdata->pmsg_size)) {
pr_err("The memory size and the record/console size must be " pr_err("The memory size and the record/console size must be "
"non-zero\n"); "non-zero\n");
err = -EINVAL;
goto fail_out; goto fail_out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment