mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Sean Fu <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: fxinrong@gmail.com, hpa@zytor.com, linux-kernel@vger.kernel.org,
	tglx@linutronix.de, mingo@kernel.org
Subject: [tip:x86/urgent] x86/sysfs: Fix off-by-one error in loop termination
Date: Mon, 25 Sep 2017 03:08:08 -0700	[thread overview]
Message-ID: <tip-7d7099433d9eaaa5a989a55f1fa354c16a3ad297@git.kernel.org> (raw)
In-Reply-To: <1505090001-1157-1-git-send-email-fxinrong@gmail.com>

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:

      parent reply	other threads:[~2017-09-25 10:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-11  0:33 [PATCH] x86: " Sean Fu
2017-09-11  0:52 ` Sean Fu
2017-09-25 10:08 ` tip-bot for Sean Fu [this message]

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=tip-7d7099433d9eaaa5a989a55f1fa354c16a3ad297@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=fxinrong@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    /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

Powered by JetHome