diff options
author | Kees Cook <keescook@chromium.org> | 2022-10-26 01:05:18 +0200 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2022-11-01 18:04:52 +0100 |
commit | e9a40e1585d792751d3a122392695e5a53032809 (patch) | |
tree | 2112765f2f0082dbe5b2a1743593a99948855c92 /include | |
parent | siphash: Convert selftest to KUnit (diff) | |
download | linux-e9a40e1585d792751d3a122392695e5a53032809.tar.xz linux-e9a40e1585d792751d3a122392695e5a53032809.zip |
fortify: Do not cast to "unsigned char"
Do not cast to "unsigned char", as this needlessly creates type problems
when attempting builds without -Wno-pointer-sign[1]. The intent of the
cast is to drop possible "const" types.
[1] https://lore.kernel.org/lkml/CAHk-=wgz3Uba8w7kdXhsqR1qvfemYL+OFQdefJnkeqXG8qZ_pA@mail.gmail.com/
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Fixes: 3009f891bb9f ("fortify: Allow strlen() and strnlen() to pass compile-time known lengths")
Cc: linux-hardening@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/fortify-string.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/fortify-string.h b/include/linux/fortify-string.h index 32a66d4b30ca..aa31f54f8b57 100644 --- a/include/linux/fortify-string.h +++ b/include/linux/fortify-string.h @@ -18,7 +18,7 @@ void __write_overflow_field(size_t avail, size_t wanted) __compiletime_warning(" #define __compiletime_strlen(p) \ ({ \ - unsigned char *__p = (unsigned char *)(p); \ + char *__p = (char *)(p); \ size_t __ret = SIZE_MAX; \ size_t __p_size = __member_size(p); \ if (__p_size != SIZE_MAX && \ |