Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd62c6c4 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Benjamin Herrenschmidt
Browse files

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
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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);