Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <kees@kernel.org>
Link: https://lore.kernel.org/r/20251118-strends-follow-up-v1-2-d3f8ef750f59@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

+2 -1
+2 -1
include/linux/string.h
··· 570 570 * Returns: 571 571 * True if @str ends with @suffix. False in all other cases. 572 572 */ 573 - static inline bool strends(const char *str, const char *suffix) 573 + static inline bool __attribute__((nonnull(1, 2))) 574 + strends(const char *str, const char *suffix) 574 575 { 575 576 unsigned int str_len = strlen(str), suffix_len = strlen(suffix); 576 577