aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/elevator.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/block/elevator.c b/block/elevator.c
index 04518921db31..9482ffa1aae6 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -1166,15 +1166,10 @@ ssize_t elv_iosched_store(struct request_queue *q, const char *name,
1166 size_t count) 1166 size_t count)
1167{ 1167{
1168 char elevator_name[ELV_NAME_MAX]; 1168 char elevator_name[ELV_NAME_MAX];
1169 size_t len;
1170 struct elevator_type *e; 1169 struct elevator_type *e;
1171 1170
1172 elevator_name[sizeof(elevator_name) - 1] = '\0'; 1171 strlcpy(elevator_name, name, sizeof(elevator_name));
1173 strncpy(elevator_name, name, sizeof(elevator_name) - 1); 1172 strstrip(elevator_name);
1174 len = strlen(elevator_name);
1175
1176 if (len && elevator_name[len - 1] == '\n')
1177 elevator_name[len - 1] = '\0';
1178 1173
1179 e = elevator_get(elevator_name); 1174 e = elevator_get(elevator_name);
1180 if (!e) { 1175 if (!e) {