From: Sean Fu <fxinrong@gmail.com>
To: tglx@linutronix.de
Cc: mingo@redhat.com, hpa@zytor.com, x86@kernel.org,
fxinrong@gmail.com, linux-kernel@vger.kernel.org
Subject: [PATCH] x86: Fix off-by-one error in loop termination.
Date: Mon, 11 Sep 2017 08:33:21 +0800 [thread overview]
Message-ID: <1505090001-1157-1-git-send-email-fxinrong@gmail.com> (raw)
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
next reply other threads:[~2017-09-11 0:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-11 0:33 Sean Fu [this message]
2017-09-11 0:52 ` Sean Fu
2017-09-25 10:08 ` [tip:x86/urgent] x86/sysfs: " tip-bot for Sean Fu
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=1505090001-1157-1-git-send-email-fxinrong@gmail.com \
--to=fxinrong@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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®