Skip to content

Commit 197f0d6

Browse files
committed
dm-stripe: small code cleanup
JIRA: https://issues.redhat.com/browse/RHEL-119009 Upstream Status: kernel/git/torvalds/linux.git commit 9f2f631 Author: Mikulas Patocka <mpatocka@redhat.com> Date: Tue Jun 3 18:58:47 2025 +0200 dm-stripe: small code cleanup This commit doesn't fix any bug, it is just code cleanup. Use the function format_dev_t instead of sprintf, because format_dev_t does the same thing. Remove the useless memset call. An unsigned integer can take at most 10 digits, so extend the array size to 22. (note that because the range of minor and major numbers is limited, the size 16 could not be exceeded, thus this function couldn't write beyond string end) Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
1 parent 4907bcb commit 197f0d6

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/md/dm-stripe.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ static int stripe_end_io(struct dm_target *ti, struct bio *bio,
405405
blk_status_t *error)
406406
{
407407
unsigned int i;
408-
char major_minor[16];
408+
char major_minor[22];
409409
struct stripe_c *sc = ti->private;
410410

411411
if (!*error)
@@ -417,8 +417,7 @@ static int stripe_end_io(struct dm_target *ti, struct bio *bio,
417417
if (*error == BLK_STS_NOTSUPP)
418418
return DM_ENDIO_DONE;
419419

420-
memset(major_minor, 0, sizeof(major_minor));
421-
sprintf(major_minor, "%d:%d", MAJOR(bio_dev(bio)), MINOR(bio_dev(bio)));
420+
format_dev_t(major_minor, bio_dev(bio));
422421

423422
/*
424423
* Test to see which stripe drive triggered the event

0 commit comments

Comments
 (0)