aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/string.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/string.c b/lib/string.c
index 0f8624532082..f71bead1be3e 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -689,13 +689,13 @@ EXPORT_SYMBOL(strstr);
689 */ 689 */
690char *strnstr(const char *s1, const char *s2, size_t len) 690char *strnstr(const char *s1, const char *s2, size_t len)
691{ 691{
692 size_t l1 = len, l2; 692 size_t l2;
693 693
694 l2 = strlen(s2); 694 l2 = strlen(s2);
695 if (!l2) 695 if (!l2)
696 return (char *)s1; 696 return (char *)s1;
697 while (l1 >= l2) { 697 while (len >= l2) {
698 l1--; 698 len--;
699 if (!memcmp(s1, s2, l2)) 699 if (!memcmp(s1, s2, l2))
700 return (char *)s1; 700 return (char *)s1;
701 s1++; 701 s1++;