x86/pkeys/selftests: Fix protection keys write() warning

write() is marked as having a must-check return value. Check it and
abort if we fail to write an error message from a signal handler.

Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20171111001232.94813E58@viggo.jf.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by Dave Hansen and committed by Ingo Molnar 7b659ee3 91c49c2d

+4 -1
+4 -1
tools/testing/selftests/x86/pkey-helpers.h
··· 30 if (!dprint_in_signal) { 31 vprintf(format, ap); 32 } else { 33 int len = vsnprintf(dprint_in_signal_buffer, 34 DPRINT_IN_SIGNAL_BUF_SIZE, 35 format, ap); ··· 40 */ 41 if (len > DPRINT_IN_SIGNAL_BUF_SIZE) 42 len = DPRINT_IN_SIGNAL_BUF_SIZE; 43 - write(1, dprint_in_signal_buffer, len); 44 } 45 va_end(ap); 46 }
··· 30 if (!dprint_in_signal) { 31 vprintf(format, ap); 32 } else { 33 + int ret; 34 int len = vsnprintf(dprint_in_signal_buffer, 35 DPRINT_IN_SIGNAL_BUF_SIZE, 36 format, ap); ··· 39 */ 40 if (len > DPRINT_IN_SIGNAL_BUF_SIZE) 41 len = DPRINT_IN_SIGNAL_BUF_SIZE; 42 + ret = write(1, dprint_in_signal_buffer, len); 43 + if (ret < 0) 44 + abort(); 45 } 46 va_end(ap); 47 }