lkml.org 
[lkml]   [2017]   [Nov]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 4/4] x86, selftests: fix protection keys write() warining
From
Date

From: Dave Hansen <dave.hansen@linux.intel.com>

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>
---

b/tools/testing/selftests/x86/pkey-helpers.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff -puN tools/testing/selftests/x86/pkey-helpers.h~x86-selftests-protection-keys-write-warning tools/testing/selftests/x86/pkey-helpers.h
--- a/tools/testing/selftests/x86/pkey-helpers.h~x86-selftests-protection-keys-write-warning 2017-11-10 15:29:29.240207938 -0800
+++ b/tools/testing/selftests/x86/pkey-helpers.h 2017-11-10 15:29:29.244207938 -0800
@@ -30,6 +30,7 @@ static inline void sigsafe_printf(const
if (!dprint_in_signal) {
vprintf(format, ap);
} else {
+ int ret;
int len = vsnprintf(dprint_in_signal_buffer,
DPRINT_IN_SIGNAL_BUF_SIZE,
format, ap);
@@ -39,7 +40,9 @@ static inline void sigsafe_printf(const
*/
if (len > DPRINT_IN_SIGNAL_BUF_SIZE)
len = DPRINT_IN_SIGNAL_BUF_SIZE;
- write(1, dprint_in_signal_buffer, len);
+ ret = write(1, dprint_in_signal_buffer, len);
+ if (ret < 0)
+ abort();
}
va_end(ap);
}
_
\
 
 \ /
  Last update: 2017-11-11 01:13    [W:0.133 / U:1.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site