Linux: Fix octal detection in define_ddi_strtox()

Clang Tidy reported this as a misc-redundant-expression because writing
`8` instead of `'8'` meant that the condition could never be true.

The only place where we have a chance of this being a bug would be in
nvlist_lookup_nvpair_ei_sep(). I am not sure if we ever pass an octal to
that, but if we ever do, it should work properly now instead of failing.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14575
This commit is contained in:
Richard Yao 2023-03-05 02:01:58 -05:00 committed by Brian Behlendorf
parent 66a38fd10a
commit 703283fabd

View File

@ -496,7 +496,7 @@ int ddi_strto##type(const char *str, char **endptr, \
if (tolower(str[1]) == 'x' && isxdigit(str[2])) { \
base = 16; /* hex */ \
ptr += 2; \
} else if (str[1] >= '0' && str[1] < 8) { \
} else if (str[1] >= '0' && str[1] < '8') { \
base = 8; /* octal */ \
ptr += 1; \
} else { \