* [PATCH] x86: Fix off-by-one error in loop termination.
@ 2017-09-11 0:33 Sean Fu
2017-09-11 0:52 ` Sean Fu
2017-09-25 10:08 ` [tip:x86/urgent] x86/sysfs: " tip-bot for Sean Fu
0 siblings, 2 replies; 3+ messages in thread
From: Sean Fu @ 2017-09-11 0:33 UTC (permalink / raw)
To: tglx; +Cc: mingo, hpa, x86, fxinrong, linux-kernel
An off-by-one error in loop terminantion conditions in
create_setup_data_nodes will lead to memory leak when
create_setup_data_node return error.
Signed-off-by: Sean Fu <fxinrong@gmail.com>
---
arch/x86/kernel/ksysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/ksysfs.c b/arch/x86/kernel/ksysfs.c
index 4afc67f..cfde6c0 100644
--- a/arch/x86/kernel/ksysfs.c
+++ b/arch/x86/kernel/ksysfs.c
@@ -299,7 +299,7 @@ static int __init create_setup_data_nodes(struct kobject *parent)
return 0;
out_clean_nodes:
- for (j = i - 1; j > 0; j--)
+ for (j = i - 1; j >= 0; j--)
cleanup_setup_data_node(*(kobjp + j));
kfree(kobjp);
out_setup_data_kobj:
--
2.6.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86: Fix off-by-one error in loop termination.
2017-09-11 0:33 [PATCH] x86: Fix off-by-one error in loop termination Sean Fu
@ 2017-09-11 0:52 ` Sean Fu
2017-09-25 10:08 ` [tip:x86/urgent] x86/sysfs: " tip-bot for Sean Fu
1 sibling, 0 replies; 3+ messages in thread
From: Sean Fu @ 2017-09-11 0:52 UTC (permalink / raw)
To: tglx; +Cc: mingo, hpa, x86, linux-kernel
On Mon, Sep 11, 2017 at 08:33:21AM +0800, Sean Fu wrote:
> An off-by-one error in loop terminantion conditions in
> create_setup_data_nodes will lead to memory leak when
> create_setup_data_node return error.
>
> Signed-off-by: Sean Fu <fxinrong@gmail.com>
> ---
> arch/x86/kernel/ksysfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kernel/ksysfs.c b/arch/x86/kernel/ksysfs.c
> index 4afc67f..cfde6c0 100644
> --- a/arch/x86/kernel/ksysfs.c
> +++ b/arch/x86/kernel/ksysfs.c
> @@ -299,7 +299,7 @@ static int __init create_setup_data_nodes(struct kobject *parent)
> return 0;
>
> out_clean_nodes:
> - for (j = i - 1; j > 0; j--)
> + for (j = i - 1; j >= 0; j--)
> cleanup_setup_data_node(*(kobjp + j));
> kfree(kobjp);
> out_setup_data_kobj:
> --
> 2.6.2
>
Appologize for the wrong subject prefix in previous email.
Resent the patch right now.
Could you please review this patch?
Thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:x86/urgent] x86/sysfs: Fix off-by-one error in loop termination
2017-09-11 0:33 [PATCH] x86: Fix off-by-one error in loop termination Sean Fu
2017-09-11 0:52 ` Sean Fu
@ 2017-09-25 10:08 ` tip-bot for Sean Fu
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Sean Fu @ 2017-09-25 10:08 UTC (permalink / raw)
To: linux-tip-commits; +Cc: fxinrong, hpa, linux-kernel, tglx, mingo
Commit-ID: 7d7099433d9eaaa5a989a55f1fa354c16a3ad297
Gitweb: http://git.kernel.org/tip/7d7099433d9eaaa5a989a55f1fa354c16a3ad297
Author: Sean Fu <fxinrong@gmail.com>
AuthorDate: Mon, 11 Sep 2017 08:33:21 +0800
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 25 Sep 2017 09:36:16 +0200
x86/sysfs: Fix off-by-one error in loop termination
An off-by-one error in loop terminantion conditions in
create_setup_data_nodes() will lead to memory leak when
create_setup_data_node() failed.
Signed-off-by: Sean Fu <fxinrong@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1505090001-1157-1-git-send-email-fxinrong@gmail.com
---
arch/x86/kernel/ksysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/ksysfs.c b/arch/x86/kernel/ksysfs.c
index 4b0592c..8c1cc08 100644
--- a/arch/x86/kernel/ksysfs.c
+++ b/arch/x86/kernel/ksysfs.c
@@ -299,7 +299,7 @@ static int __init create_setup_data_nodes(struct kobject *parent)
return 0;
out_clean_nodes:
- for (j = i - 1; j > 0; j--)
+ for (j = i - 1; j >= 0; j--)
cleanup_setup_data_node(*(kobjp + j));
kfree(kobjp);
out_setup_data_kobj:
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-09-25 10:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-11 0:33 [PATCH] x86: Fix off-by-one error in loop termination Sean Fu
2017-09-11 0:52 ` Sean Fu
2017-09-25 10:08 ` [tip:x86/urgent] x86/sysfs: " tip-bot for Sean Fu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome