Commit 194832dc authored by Bartosz Golaszewski's avatar Bartosz Golaszewski
Browse files

string: use __attribute__((nonnull())) in strends()



The arguments of strends() must not be NULL so annotate the function
with the nonnull attribute.

Suggested-by: default avatarKees Cook <kees@kernel.org>
Link: https://lore.kernel.org/r/20251118-strends-follow-up-v1-2-d3f8ef750f59@linaro.org


Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
parent 72eb5b1f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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);