kgdb: fix potential out-of-bounds access
PATCH 1/1 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 <[email protected]>
Cc Jason Wessel <[email protected]>
---
Untested
kernel/debug/kdb/kdb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/debug/kdb/kdb_main.c +1 -1
@@ -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;
Signature · 1 line
1.9.1
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 3 lines · Jason Wessel
This is actually already fixed a different way in the kgdb-next:
Great. Thanks for the quick response.
Brian