From: Wang Yufen <wangyufen@huawei.com>
To: <keescook@chromium.org>, <anton@enomsg.org>, <ccross@android.com>,
<tony.luck@intel.com>
Cc: <linux-kernel@vger.kernel.org>, Wang Yufen <wangyufen@huawei.com>
Subject: [PATCH] pstore/ram: Fix error return code in ramoops_probe()
Date: Fri, 2 Dec 2022 16:22:54 +0800 [thread overview]
Message-ID: <1669969374-46582-1-git-send-email-wangyufen@huawei.com> (raw)
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>
---
fs/pstore/ram.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index fefe3d3..74e4d93 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;
}
--
1.8.3.1
next reply other threads:[~2022-12-02 8:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-02 8:22 Wang Yufen [this message]
2022-12-02 23:20 ` Kees Cook
-- strict thread matches above, loose matches on Subject: below --
2013-05-07 11:39 [PATCH] pstore/ram: fix " Wei Yongjun
2013-05-07 15:46 ` Kees Cook
2013-05-08 18:14 ` Luck, Tony
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1669969374-46582-1-git-send-email-wangyufen@huawei.com \
--to=wangyufen@huawei.com \
--cc=anton@enomsg.org \
--cc=ccross@android.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®