All of lore.kernel.org
 help / color / mirror / Atom feed
* [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

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.