From: Bartosz Golaszewski Date: Tue, 18 Nov 2025 10:04:04 +0000 (+0100) Subject: string: use __attribute__((nonnull())) in strends() X-Git-Tag: v6.19-rc1~146^2~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=194832dcb13b0d02fce0df887235b7e6d1ef0121;p=thirdparty%2Flinux.git string: use __attribute__((nonnull())) in strends() The arguments of strends() must not be NULL so annotate the function with the nonnull attribute. Suggested-by: Kees Cook Link: https://lore.kernel.org/r/20251118-strends-follow-up-v1-2-d3f8ef750f59@linaro.org Signed-off-by: Bartosz Golaszewski --- diff --git a/include/linux/string.h b/include/linux/string.h index 69e9256592f87..0266dbdaa4cde 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -570,7 +570,8 @@ static inline bool strstarts(const char *str, const char *prefix) * Returns: * True if @str ends with @suffix. False in all other cases. */ -static inline bool strends(const char *str, const char *suffix) +static inline bool __attribute__((nonnull(1, 2))) +strends(const char *str, const char *suffix) { unsigned int str_len = strlen(str), suffix_len = strlen(suffix);