Commit f46ebb91 authored by Thorsten Blum's avatar Thorsten Blum Committed by Jens Axboe
Browse files

block: Replace snprintf with strscpy in check_partition



Replace snprintf("%s", ...) with the faster and more direct strscpy().

Signed-off-by: default avatarThorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 7c746eb7
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
#include <linux/fs.h>
#include <linux/major.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/ctype.h>
#include <linux/vmalloc.h>
#include <linux/raid/detect.h>
@@ -130,7 +131,7 @@ static struct parsed_partitions *check_partition(struct gendisk *hd)
	state->pp_buf[0] = '\0';

	state->disk = hd;
	snprintf(state->name, BDEVNAME_SIZE, "%s", hd->disk_name);
	strscpy(state->name, hd->disk_name);
	snprintf(state->pp_buf, PAGE_SIZE, " %s:", state->name);
	if (isdigit(state->name[strlen(state->name)-1]))
		sprintf(state->name, "p");