[PATCH] block/elevator.c: forget about strncpy()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Alexey Dobriyan <[email protected]>
---

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

--- 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')

-
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/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux