From: André Goddard Rosa Date: Tue, 15 Dec 2009 02:01:04 +0000 (-0800) Subject: string: on strstrip(), first remove leading spaces before running over str X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=84c95c9acf088c99d8793d78036b67faa5d0b851;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git string: on strstrip(), first remove leading spaces before running over str ... so that strlen() iterates over a smaller string comprising of the remaining characters only. Signed-off-by: André Goddard Rosa Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/lib/string.c b/lib/string.c index 3a912a4e9a63..765566a6a088 100644 --- a/lib/string.c +++ b/lib/string.c @@ -364,8 +364,8 @@ char *strstrip(char *s) size_t size; char *end; + s = skip_spaces(s); size = strlen(s); - if (!size) return s; @@ -374,7 +374,7 @@ char *strstrip(char *s) end--; *(end + 1) = '\0'; - return skip_spaces(s); + return s; } EXPORT_SYMBOL(strstrip);