From f1db99c07b4f0a9edc45f3498d4d13d13a41836a Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Wed, 8 Feb 2023 15:31:51 +0200 Subject: string_helpers: Move string_is_valid() to the header Move string_is_valid() to the header for wider use. While at it, rename to string_is_terminated() to be precise about its semantics. Signed-off-by: Andy Shevchenko Reviewed-by: Simon Horman Reviewed-by: Jiri Pirko Link: https://lore.kernel.org/r/20230208133153.22528-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jakub Kicinski --- include/linux/string_helpers.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/linux/string_helpers.h') diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h index 8530c7328269..fae6beaaa217 100644 --- a/include/linux/string_helpers.h +++ b/include/linux/string_helpers.h @@ -11,6 +11,11 @@ struct device; struct file; struct task_struct; +static inline bool string_is_terminated(const char *s, int len) +{ + return memchr(s, '\0', len) ? true : false; +} + /* Descriptions of the types of units to * print in */ enum string_size_units { -- cgit v1.2.3