Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Thorsten Blum and committed by
Jens Axboe
f46ebb91 7c746eb7

+2 -1
+2 -1
block/partitions/core.c
··· 7 7 #include <linux/fs.h> 8 8 #include <linux/major.h> 9 9 #include <linux/slab.h> 10 + #include <linux/string.h> 10 11 #include <linux/ctype.h> 11 12 #include <linux/vmalloc.h> 12 13 #include <linux/raid/detect.h> ··· 131 130 state->pp_buf[0] = '\0'; 132 131 133 132 state->disk = hd; 134 - snprintf(state->name, BDEVNAME_SIZE, "%s", hd->disk_name); 133 + strscpy(state->name, hd->disk_name); 135 134 snprintf(state->pp_buf, PAGE_SIZE, " %s:", state->name); 136 135 if (isdigit(state->name[strlen(state->name)-1])) 137 136 sprintf(state->name, "p");