summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorsten Blum <thorsten.blum@linux.dev>2026-01-27 23:47:01 +0100
committerJens Axboe <axboe@kernel.dk>2026-01-28 05:28:13 -0700
commitf46ebb910989a1db244f95bd1f937907591aa2ee (patch)
tree10e9bf6fa8dfd3b39cfa84e011bd772a678b253c
parent7c746eb71fc3737340c32f44c31b111f74f5632c (diff)
block: Replace snprintf with strscpy in check_partition
Replace snprintf("%s", ...) with the faster and more direct strscpy(). Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--block/partitions/core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/block/partitions/core.c b/block/partitions/core.c
index 815ed33caa1b..079057ab535a 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -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");