* [PATCH] kgdb: fix potential out-of-bounds access
@ 2015-01-12 19:45 Brian Norris
[not found] ` <54B42664.1080302@windriver.com>
0 siblings, 1 reply; 2+ messages in thread
From: Brian Norris @ 2015-01-12 19:45 UTC (permalink / raw)
To: Jason Wessel; +Cc: linux-kernel, Brian Norris, kgdb-bugreport, Daniel Thompson
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] kgdb: fix potential out-of-bounds access
[not found] ` <54B42664.1080302@windriver.com>
@ 2015-01-12 19:57 ` Brian Norris
0 siblings, 0 replies; 2+ messages in thread
From: Brian Norris @ 2015-01-12 19:57 UTC (permalink / raw)
To: Jason Wessel; +Cc: Linux Kernel, kgdb-bugreport, Daniel Thompson
On Mon, Jan 12, 2015 at 11:54 AM, Jason Wessel
<jason.wessel@windriver.com> wrote:
> This is actually already fixed a different way in the kgdb-next:
>
> https://git.kernel.org/cgit/linux/kernel/git/jwessel/kgdb.git/commit/?h=kgdb-next&id=c7d9ebf81c456dc185c8eae9e293bfdccf2a65f5
Great. Thanks for the quick response.
Brian
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-12 19:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-12 19:45 [PATCH] kgdb: fix potential out-of-bounds access Brian Norris
[not found] ` <54B42664.1080302@windriver.com>
2015-01-12 19:57 ` Brian Norris
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.