Skip to contentSkip to conversation

reboot: Replace strncmp with str_has_prefix

PATCH In review Chuhong Yuan 1 participant 1 message Jul 29, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 9/12 reboot: Replace strncmp with str_has_prefix

strncmp(str, const, len) is error-prone.
We had better use newly introduced
str_has_prefix() instead of it.

---
 kernel/reboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/reboot.c +1 -1
index c4d472b7f1b4..88098cf922b8 100644
@@ -530,7 +530,7 @@ static int __init reboot_setup(char *str)
 		 */
 		reboot_default = 0;
 
-		if (!strncmp(str, "panic_", 6)) {
+		if (str_has_prefix(str, "panic_")) {
 			mode = &panic_reboot_mode;
 			str += 6;
 		} else {
Signature · 1 line
2.20.1