Commit fd62c6c4 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by 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: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev@ozlabs.org
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 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%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment