diff options
author | Wang Yufen <wangyufen@huawei.com> | 2022-12-02 11:22:54 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-12-31 15:31:54 +0300 |
commit | 65f1ff9011f1d533d0a23c3294d82e0146f2648b (patch) | |
tree | 8c07cf9ac76c6e6a927d2af1a5cd8e68880d20a4 | |
parent | 5b81f0c6c60e35bf8153230ddfb03ebb14e17986 (diff) | |
download | linux-65f1ff9011f1d533d0a23c3294d82e0146f2648b.tar.xz |
pstore/ram: Fix error return code in ramoops_probe()
[ Upstream commit e1fce564900f8734edf15b87f028c57e14f6e28d ]
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: 35da60941e44 ("pstore/ram: add Device Tree bindings")
Signed-off-by: Wang Yufen <wangyufen@huawei.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/1669969374-46582-1-git-send-email-wangyufen@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | fs/pstore/ram.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index fefe3d391d3a..74e4d93f3e08 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -735,6 +735,7 @@ static int ramoops_probe(struct platform_device *pdev) /* Make sure we didn't get bogus platform data pointer. */ if (!pdata) { pr_err("NULL platform data\n"); + err = -EINVAL; goto fail_out; } @@ -742,6 +743,7 @@ static int ramoops_probe(struct platform_device *pdev) !pdata->ftrace_size && !pdata->pmsg_size)) { pr_err("The memory size and the record/console size must be " "non-zero\n"); + err = -EINVAL; goto fail_out; } |