[PATCH] kernel/kexec.c: Use strchrnul

From: Rasmus Villemoes
Date: Fri Jan 30 2015 - 08:33:32 EST


strchrnul exists precisely for this use case.

Signed-off-by: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>
---
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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/