From a4bc304da5792596791f08a70d71e22034ae7318 Mon Sep 17 00:00:00 2001 From: Andriy Gapon Date: Thu, 5 Oct 2017 12:25:18 +0000 Subject: [PATCH] remove heuristic error detection from ddi_strto*() Zero, _MIN and _MAX values can result from valid conversions. They don't necessarily imply any error. Since we do not have any reliable error signaling from libkern's strto*(), it's better to always assume success rather than to report an error when there is none. Reviewed by: tsoome MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D12565 --- .../compat/opensolaris/kern/opensolaris_sunddi.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/sys/cddl/compat/opensolaris/kern/opensolaris_sunddi.c b/sys/cddl/compat/opensolaris/kern/opensolaris_sunddi.c index 64edbe85bda..4a13cd8956c 100644 --- a/sys/cddl/compat/opensolaris/kern/opensolaris_sunddi.c +++ b/sys/cddl/compat/opensolaris/kern/opensolaris_sunddi.c @@ -41,10 +41,6 @@ ddi_strtol(const char *str, char **nptr, int base, long *result) { *result = strtol(str, nptr, base); - if (*result == 0) - return (EINVAL); - else if (*result == LONG_MIN || *result == LONG_MAX) - return (ERANGE); return (0); } @@ -58,10 +54,6 @@ ddi_strtoul(const char *str, char **nptr, int base, unsigned long *result) } *result = strtoul(str, nptr, base); - if (*result == 0) - return (EINVAL); - else if (*result == ULONG_MAX) - return (ERANGE); return (0); } @@ -70,10 +62,6 @@ ddi_strtoull(const char *str, char **nptr, int base, unsigned long long *result) { *result = (unsigned long long)strtouq(str, nptr, base); - if (*result == 0) - return (EINVAL); - else if (*result == ULLONG_MAX) - return (ERANGE); return (0); }