[PATCH] kgdb: fix potential out-of-bounds access
From: Brian Norris
Date: Mon Jan 12 2015 - 14:45:26 EST
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@xxxxxxxxx>
Cc: Jason Wessel <jason.wessel@xxxxxxxxxxxxx>
---
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/