From: Brian Norris <computersforpeace@gmail.com>
To: Jason Wessel <jason.wessel@windriver.com>
Cc: <linux-kernel@vger.kernel.org>,
Brian Norris <computersforpeace@gmail.com>,
kgdb-bugreport@lists.sourceforge.net,
Daniel Thompson <daniel.thompson@linaro.org>
Subject: [PATCH] kgdb: fix potential out-of-bounds access
Date: Mon, 12 Jan 2015 11:45:00 -0800 [thread overview]
Message-ID: <1421091900-19249-1-git-send-email-computersforpeace@gmail.com> (raw)
CPU arrays (e.g., kgdb_info[]) are indexed from 0 (inclusive) to NR_CPUS
(exclusive).
Pointed out by Coverity, CID 1262269
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Cc: Jason Wessel <jason.wessel@windriver.com>
---
Untested
kernel/debug/kdb/kdb_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
index f191bddf64b8..53f051853f14 100644
--- a/kernel/debug/kdb/kdb_main.c
+++ b/kernel/debug/kdb/kdb_main.c
@@ -2256,7 +2256,7 @@ static int kdb_cpu(int argc, const char **argv)
/*
* Validate cpunum
*/
- if ((cpunum > NR_CPUS) || !kgdb_info[cpunum].enter_kgdb)
+ if ((cpunum >= NR_CPUS) || !kgdb_info[cpunum].enter_kgdb)
return KDB_BADCPUNUM;
dbg_switch_cpu = cpunum;
--
1.9.1
next reply other threads:[~2015-01-12 19:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-12 19:45 Brian Norris [this message]
[not found] ` <54B42664.1080302@windriver.com>
2015-01-12 19:57 ` [PATCH] kgdb: fix potential out-of-bounds access Brian Norris
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=1421091900-19249-1-git-send-email-computersforpeace@gmail.com \
--to=computersforpeace@gmail.com \
--cc=daniel.thompson@linaro.org \
--cc=jason.wessel@windriver.com \
--cc=kgdb-bugreport@lists.sourceforge.net \
--cc=linux-kernel@vger.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