aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorJohn Blackwood <john.blackwood@ccur.com>2012-12-10 16:37:22 -0500
committerJason Wessel <jason.wessel@windriver.com>2013-03-02 09:52:16 -0500
commitf7c82d5a3c537a4b4d9d0395db4606bf4d3c7a5f (patch)
tree611d31e816535a32aad7f4ad541df62a8aae24d7 /kernel
parent19f949f52599ba7c3f67a5897ac6be14bfcb1200 (diff)
kdb: A fix for kdb command table expansion
When locally adding in some additional kdb commands, I stumbled across an issue with the dynamic expansion of the kdb command table. When the number of kdb commands exceeds the size of the statically allocated kdb_base_commands[] array, additional space is allocated in the kdb_register_repeat() routine. The unused portion of the newly allocated array was not being initialized to zero properly and this would result in segfaults when help '?' was executed or when a search for a non-existing command would traverse the command table beyond the end of valid command entries and then attempt to use the non-zeroed area as actual command entries. Signed-off-by: John Blackwood <john.blackwood@ccur.com> Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/debug/kdb/kdb_main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
index 8875254120b6..a52493a66cf2 100644
--- a/kernel/debug/kdb/kdb_main.c
+++ b/kernel/debug/kdb/kdb_main.c
@@ -2739,7 +2739,7 @@ int kdb_register_repeat(char *cmd,
2739 (kdb_max_commands - KDB_BASE_CMD_MAX) * sizeof(*new)); 2739 (kdb_max_commands - KDB_BASE_CMD_MAX) * sizeof(*new));
2740 kfree(kdb_commands); 2740 kfree(kdb_commands);
2741 } 2741 }
2742 memset(new + kdb_max_commands, 0, 2742 memset(new + kdb_max_commands - KDB_BASE_CMD_MAX, 0,
2743 kdb_command_extend * sizeof(*new)); 2743 kdb_command_extend * sizeof(*new));
2744 kdb_commands = new; 2744 kdb_commands = new;
2745 kp = kdb_commands + kdb_max_commands - KDB_BASE_CMD_MAX; 2745 kp = kdb_commands + kdb_max_commands - KDB_BASE_CMD_MAX;