diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2009-10-14 18:54:40 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-10-30 02:21:28 -0400 |
commit | fd62c6c448669a946e94fbb0ad179918b2233e3d (patch) | |
tree | 3067f9abbfeea2a41a0a183057bcf76d7ddaba3d /arch/powerpc/kernel | |
parent | ae7dd0208f62f1d6db4c49b85e54fa7bbed0ea4e (diff) |
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: Thomas Gleixner <tglx@linutronix.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev@ozlabs.org
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r-- | arch/powerpc/kernel/nvram_64.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c index c67e0102df96..89d4af2a13ef 100644 --- a/arch/powerpc/kernel/nvram_64.c +++ b/arch/powerpc/kernel/nvram_64.c | |||
@@ -681,6 +681,9 @@ int nvram_clear_error_log(void) | |||
681 | int clear_word = ERR_FLAG_ALREADY_LOGGED; | 681 | int clear_word = ERR_FLAG_ALREADY_LOGGED; |
682 | int rc; | 682 | int rc; |
683 | 683 | ||
684 | if (nvram_error_log_index == -1) | ||
685 | return -1; | ||
686 | |||
684 | tmp_index = nvram_error_log_index; | 687 | tmp_index = nvram_error_log_index; |
685 | 688 | ||
686 | rc = ppc_md.nvram_write((char *)&clear_word, sizeof(int), &tmp_index); | 689 | rc = ppc_md.nvram_write((char *)&clear_word, sizeof(int), &tmp_index); |