From ae8c1d5cc7b7242bad6cf52a6bcaa681ea743b72 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Tue, 13 Feb 2018 05:05:13 +0000 Subject: [PATCH] Consistently use MAX_ERRNO_VALUE * filter_qualify.c (parse_inject_token): Replace 4095 with MAX_ERRNO_VALUE. * negated_errno.h (is_negated_errno): Likewise. Remove redundant comment. --- filter_qualify.c | 2 +- negated_errno.h | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/filter_qualify.c b/filter_qualify.c index 554536a2..e41af89e 100644 --- a/filter_qualify.c +++ b/filter_qualify.c @@ -139,7 +139,7 @@ parse_inject_token(const char *const token, struct inject_opts *const fopts, " clipped to %d in compat personality", intval, (int) intval); - if ((int) intval < 0 && (int) intval >= -4095) + if ((int) intval < 0 && (int) intval >= -MAX_ERRNO_VALUE) error_msg("Inadvertent injection of error %d is" " possible in compat personality for" " retval=%" PRI_kld, diff --git a/negated_errno.h b/negated_errno.h index 9ec851b0..01eb045e 100644 --- a/negated_errno.h +++ b/negated_errno.h @@ -35,8 +35,7 @@ static inline bool is_negated_errno(kernel_ulong_t val) { - /* Linux kernel defines MAX_ERRNO to 4095. */ - kernel_ulong_t max = -(kernel_long_t) 4095; + kernel_ulong_t max = -(kernel_long_t) MAX_ERRNO_VALUE; #ifndef current_klongsize if (current_klongsize < sizeof(val)) { -- 2.40.0