kdb: Fix oops in kdb_unregister
authorJason Wessel <jason.wessel@windriver.com>
Mon, 11 Oct 2010 15:20:14 +0000 (10:20 -0500)
committerJason Wessel <jason.wessel@windriver.com>
Fri, 22 Oct 2010 20:34:12 +0000 (15:34 -0500)
Nothing should try to use kdb_commands directly as sometimes it is
null.  Instead, use the for_each_kdbcmd() iterator.

This particular problem dates back to the initial kdb merge (2.6.35),
but at that point nothing was dynamically unregistering commands from
the kdb shell.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
kernel/debug/kdb/kdb_main.c

index 5448990a299e9bfca04acde34ad622ebe68d3253..4226f32517d178f2330e97b0acb92f78f97013ce 100644 (file)
@@ -2826,7 +2826,7 @@ int kdb_unregister(char *cmd)
        /*
         *  find the command.
         */
-       for (i = 0, kp = kdb_commands; i < kdb_max_commands; i++, kp++) {
+       for_each_kdbcmd(kp, i) {
                if (kp->cmd_name && (strcmp(kp->cmd_name, cmd) == 0)) {
                        kp->cmd_name = NULL;
                        return 0;