提交 fd62c6c4 编写于 作者: T Thomas Gleixner 提交者: Benjamin Herrenschmidt

powerpc/nvram_64: Check nvram_error_log_index in nvram_clear_error_log()

nvram_clear_error_log() calls ppc_md.nvram_write() even when
nvram_error_log_index is -1 (invalid). The nvram_write() function does
not check for a negative offset.

Check nvram_error_log_index as the other nvram log functions do.
Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev@ozlabs.org
Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
上级 ae7dd020
...@@ -681,6 +681,9 @@ int nvram_clear_error_log(void) ...@@ -681,6 +681,9 @@ int nvram_clear_error_log(void)
int clear_word = ERR_FLAG_ALREADY_LOGGED; int clear_word = ERR_FLAG_ALREADY_LOGGED;
int rc; int rc;
if (nvram_error_log_index == -1)
return -1;
tmp_index = nvram_error_log_index; tmp_index = nvram_error_log_index;
rc = ppc_md.nvram_write((char *)&clear_word, sizeof(int), &tmp_index); rc = ppc_md.nvram_write((char *)&clear_word, sizeof(int), &tmp_index);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册