Skip to content

Commit

Permalink
powerpc/nvram_64: Check nvram_error_log_index in nvram_clear_error_log()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thomas Gleixner authored and Benjamin Herrenschmidt committed Oct 30, 2009
1 parent ae7dd02 commit fd62c6c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions arch/powerpc/kernel/nvram_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,9 @@ int nvram_clear_error_log(void)
int clear_word = ERR_FLAG_ALREADY_LOGGED;
int rc;

if (nvram_error_log_index == -1)
return -1;

tmp_index = nvram_error_log_index;

rc = ppc_md.nvram_write((char *)&clear_word, sizeof(int), &tmp_index);
Expand Down

0 comments on commit fd62c6c

Please sign in to comment.