[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1421091900-19249-1-git-send-email-computersforpeace@gmail.com>
Date: Mon, 12 Jan 2015 11:45:00 -0800
From: Brian Norris <computersforpeace@...il.com>
To: Jason Wessel <jason.wessel@...driver.com>
Cc: <linux-kernel@...r.kernel.org>,
Brian Norris <computersforpeace@...il.com>,
kgdb-bugreport@...ts.sourceforge.net,
Daniel Thompson <daniel.thompson@...aro.org>
Subject: [PATCH] kgdb: fix potential out-of-bounds access
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@...il.com>
Cc: Jason Wessel <jason.wessel@...driver.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists