* [PATCH] pstore/ram: fix error return code in ramoops_probe()
@ 2013-05-07 11:39 Wei Yongjun
2013-05-07 15:46 ` Kees Cook
2013-05-08 18:14 ` Luck, Tony
0 siblings, 2 replies; 5+ messages in thread
From: Wei Yongjun @ 2013-05-07 11:39 UTC (permalink / raw)
To: cbouatmailru, ccross, keescook, tony.luck; +Cc: yongjun_wei, linux-kernel
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
fs/pstore/ram.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 32cbd7c..1376e5a 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -438,6 +438,7 @@ static int ramoops_probe(struct platform_device *pdev)
pr_err("memory size too small, minimum is %zu\n",
cxt->console_size + cxt->record_size +
cxt->ftrace_size);
+ err = -EINVAL;
goto fail_cnt;
}
@@ -455,6 +456,7 @@ static int ramoops_probe(struct platform_device *pdev)
spin_lock_init(&cxt->pstore.buf_lock);
if (!cxt->pstore.buf) {
pr_err("cannot allocate pstore buffer\n");
+ err = -ENOMEM;
goto fail_clear;
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] pstore/ram: fix error return code in ramoops_probe()
2013-05-07 11:39 [PATCH] pstore/ram: fix error return code in ramoops_probe() Wei Yongjun
@ 2013-05-07 15:46 ` Kees Cook
2013-05-08 18:14 ` Luck, Tony
1 sibling, 0 replies; 5+ messages in thread
From: Kees Cook @ 2013-05-07 15:46 UTC (permalink / raw)
To: Wei Yongjun; +Cc: Anton Vorontsov, Colin Cross, Tony Luck, yongjun_wei, LKML
On Tue, May 7, 2013 at 4:39 AM, Wei Yongjun <weiyj.lk@gmail.com> wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> Fix to return a negative error code from the error handling
> case instead of 0, as done elsewhere in this function.
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Good catch, thanks!
Acked-by: Kees Cook <keescook@chromium.org>
-Kees
--
Kees Cook
Chrome OS Security
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] pstore/ram: fix error return code in ramoops_probe()
2013-05-07 11:39 [PATCH] pstore/ram: fix error return code in ramoops_probe() Wei Yongjun
2013-05-07 15:46 ` Kees Cook
@ 2013-05-08 18:14 ` Luck, Tony
1 sibling, 0 replies; 5+ messages in thread
From: Luck, Tony @ 2013-05-08 18:14 UTC (permalink / raw)
To: Wei Yongjun, cbouatmailru, ccross, keescook; +Cc: yongjun_wei, linux-kernel
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> Fix to return a negative error code from the error handling
> case instead of 0, as done elsewhere in this function.
Applied - will be in a "please pull" to Linus soon.
Thanks
-Tony
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] pstore/ram: Fix error return code in ramoops_probe()
2022-12-02 8:22 [PATCH] pstore/ram: Fix " Wang Yufen
@ 2022-12-02 23:20 ` Kees Cook
0 siblings, 0 replies; 5+ messages in thread
From: Kees Cook @ 2022-12-02 23:20 UTC (permalink / raw)
To: wangyufen, ccross, anton, Tony Luck; +Cc: Kees Cook, linux-kernel
On Fri, 2 Dec 2022 16:22:54 +0800, Wang Yufen wrote:
> 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.
>
>
Applied to for-next/pstore, thanks!
[1/1] pstore/ram: Fix error return code in ramoops_probe()
https://git.kernel.org/kees/c/e1fce564900f
--
Kees Cook
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] pstore/ram: Fix error return code in ramoops_probe()
@ 2022-12-02 8:22 Wang Yufen
2022-12-02 23:20 ` Kees Cook
0 siblings, 1 reply; 5+ messages in thread
From: Wang Yufen @ 2022-12-02 8:22 UTC (permalink / raw)
To: keescook, anton, ccross, tony.luck; +Cc: linux-kernel, Wang Yufen
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-12-02 23:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-07 11:39 [PATCH] pstore/ram: fix error return code in ramoops_probe() Wei Yongjun
2013-05-07 15:46 ` Kees Cook
2013-05-08 18:14 ` Luck, Tony
2022-12-02 8:22 [PATCH] pstore/ram: Fix " Wang Yufen
2022-12-02 23:20 ` Kees Cook
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.