block/elevator.c: forget about strncpy()
diff mbox series

Message ID 20051112185220.GA19840@mipter.zuzino.mipt.ru
State New, archived
Headers show
Series
  • block/elevator.c: forget about strncpy()
Related show

Commit Message

Alexey Dobriyan Nov. 12, 2005, 6:52 p.m. UTC
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 block/elevator.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)


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

Patch
diff mbox series

--- a/block/elevator.c
+++ b/block/elevator.c
@@ -163,7 +163,7 @@  static void elevator_setup_default(void)
 
 static int __init elevator_setup(char *str)
 {
-	strncpy(chosen_elevator, str, sizeof(chosen_elevator) - 1);
+	strlcpy(chosen_elevator, str, sizeof(chosen_elevator));
 	return 0;
 }
 
@@ -751,8 +751,7 @@  ssize_t elv_iosched_store(request_queue_
 	size_t len;
 	struct elevator_type *e;
 
-	elevator_name[sizeof(elevator_name) - 1] = '\0';
-	strncpy(elevator_name, name, sizeof(elevator_name) - 1);
+	strlcpy(elevator_name, name, sizeof(elevator_name));
 	len = strlen(elevator_name);
 
 	if (len && elevator_name[len - 1] == '\n')