[PATCH 3/8] string: correct documentation for strstr and strnstr

Rasmus Villemoes rv at rasmusvillemoes.dk
Wed Jul 1 19:15:30 CEST 2026


The len parameter for strnstr() concerns the maximum size of the
haystack to consider, not the length of the needle being searched for.

strstr() obviously has no len parameter, so remove the copy-pasta.

Signed-off-by: Rasmus Villemoes <rv at rasmusvillemoes.dk>
---
 lib/string.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/string.c b/lib/string.c
index a76dcd48d20..45f0f5f8d09 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -702,7 +702,7 @@ void *memdup(const void *src, size_t len)
  *
  * @s1:		string to be searched
  * @s2:		string to search for
- * @len:	maximum number of characters in s2 to consider
+ * @len:	maximum number of characters in s1 to consider
  *
  * Return:	pointer to the first occurrence or NULL
  */
@@ -728,7 +728,6 @@ char *strnstr(const char *s1, const char *s2, size_t len)
  *
  * @s1:		string to be searched
  * @s2:		string to search for
- * @len:	maximum number of characters in s2 to consider
  *
  * Return:	pointer to the first occurrence or NULL
  */
-- 
2.54.0



More information about the U-Boot mailing list