From 703283fabd147e2147a93fc9d83d9ca57b3c0fdd Mon Sep 17 00:00:00 2001 From: Richard Yao Date: Sun, 5 Mar 2023 02:01:58 -0500 Subject: [PATCH] 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 Signed-off-by: Richard Yao Closes #14575 --- module/os/linux/spl/spl-generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/os/linux/spl/spl-generic.c b/module/os/linux/spl/spl-generic.c index 38515023e4b..986db151845 100644 --- a/module/os/linux/spl/spl-generic.c +++ b/module/os/linux/spl/spl-generic.c @@ -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 { \ -- 2.45.0