Skip to content

Commit e1fce56

Browse files
wangyufen316kees
authored andcommitted
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: 35da609 ("pstore/ram: add Device Tree bindings") Signed-off-by: Wang Yufen <[email protected]> Signed-off-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 38b9184 commit e1fce56

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/pstore/ram.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,13 +745,15 @@ static int ramoops_probe(struct platform_device *pdev)
745745
/* Make sure we didn't get bogus platform data pointer. */
746746
if (!pdata) {
747747
pr_err("NULL platform data\n");
748+
err = -EINVAL;
748749
goto fail_out;
749750
}
750751

751752
if (!pdata->mem_size || (!pdata->record_size && !pdata->console_size &&
752753
!pdata->ftrace_size && !pdata->pmsg_size)) {
753754
pr_err("The memory size and the record/console size must be "
754755
"non-zero\n");
756+
err = -EINVAL;
755757
goto fail_out;
756758
}
757759

0 commit comments

Comments
 (0)