* [PATCH 2/2] x86: Fix off-by-one error in loop termination.
@ 2017-09-10 15:40 Sean Fu
0 siblings, 0 replies; only message in thread
From: Sean Fu @ 2017-09-10 15:40 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] only message in thread
only message in thread, other threads:[~2017-09-10 15:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-10 15:40 [PATCH 2/2] x86: Fix off-by-one error in loop termination Sean Fu
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®