浏览代码

kdb: Fix oops in kdb_unregister

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>
Jason Wessel 14 年之前
父节点
当前提交
75d14edee5
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      kernel/debug/kdb/kdb_main.c

+ 1 - 1
kernel/debug/kdb/kdb_main.c

@@ -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;