From: Thorsten Blum Date: Tue, 27 Jan 2026 22:47:01 +0000 (+0100) Subject: block: Replace snprintf with strscpy in check_partition X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f46ebb910989a1db244f95bd1f937907591aa2ee;p=thirdparty%2Fkernel%2Flinux.git block: Replace snprintf with strscpy in check_partition Replace snprintf("%s", ...) with the faster and more direct strscpy(). Signed-off-by: Thorsten Blum Signed-off-by: Jens Axboe --- diff --git a/block/partitions/core.c b/block/partitions/core.c index 815ed33caa1b8..079057ab535a6 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -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");