Skip to content

Commit e9a40e1

Browse files
committed
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 <[email protected]> Fixes: 3009f89 ("fortify: Allow strlen() and strnlen() to pass compile-time known lengths") Cc: [email protected] Signed-off-by: Kees Cook <[email protected]>
1 parent fb3d88a commit e9a40e1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/linux/fortify-string.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ void __write_overflow_field(size_t avail, size_t wanted) __compiletime_warning("
1818

1919
#define __compiletime_strlen(p) \
2020
({ \
21-
unsigned char *__p = (unsigned char *)(p); \
21+
char *__p = (char *)(p); \
2222
size_t __ret = SIZE_MAX; \
2323
size_t __p_size = __member_size(p); \
2424
if (__p_size != SIZE_MAX && \

0 commit comments

Comments
 (0)