[PATCH] kernel/kexec.c: Use strchrnul

Rasmus Villemoes linux at rasmusvillemoes.dk
Fri Jan 30 05:32:52 PST 2015


strchrnul exists precisely for this use case.

Signed-off-by: Rasmus Villemoes <linux at rasmusvillemoes.dk>
---
 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




More information about the kexec mailing list