strchrnul exists precisely for this use case.

Signed-off-by: Rasmus Villemoes <[email protected]>
---
 kernel/kexec.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/kernel/kexec.c b/kernel/kexec.c
index 9a8a01abbaed..70e7050f7ab9 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -1792,12 +1792,9 @@ static __init char *get_last_crashkernel(char *cmdline,
        /* find crashkernel and use the last one if there are more */
        p = strstr(p, name);
        while (p) {
-               char *end_p = strchr(p, ' ');
+               char *end_p = strchrnul(p, ' ');
                char *q;
 
-               if (!end_p)
-                       end_p = p + strlen(p);
-
                if (!suffix) {
                        int i;
 
-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to