Skip to content

Commit 8aeea03

Browse files
Villemoesaxboe
authored andcommitted
mtip32xx: use formatting capability of kthread_create_on_node
kthread_create_on_node takes format+args, so there's no need to do the pretty-printing in advance. Moreover, "mtip_svc_thd_99" (including its '\0') only just fits in 16 bytes, so if index could ever go above 99 we'd have a stack buffer overflow. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Reviewed-by: Jeff Moyer <jmoyer@redhat.com> Signed-off-by: Jens Axboe <axboe@fb.com>
1 parent 604e8c8 commit 8aeea03

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/block/mtip32xx/mtip32xx.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3810,7 +3810,6 @@ static int mtip_block_initialize(struct driver_data *dd)
38103810
sector_t capacity;
38113811
unsigned int index = 0;
38123812
struct kobject *kobj;
3813-
unsigned char thd_name[16];
38143813

38153814
if (dd->disk)
38163815
goto skip_create_disk; /* hw init done, before rebuild */
@@ -3958,10 +3957,9 @@ static int mtip_block_initialize(struct driver_data *dd)
39583957
}
39593958

39603959
start_service_thread:
3961-
sprintf(thd_name, "mtip_svc_thd_%02d", index);
39623960
dd->mtip_svc_handler = kthread_create_on_node(mtip_service_thread,
3963-
dd, dd->numa_node, "%s",
3964-
thd_name);
3961+
dd, dd->numa_node,
3962+
"mtip_svc_thd_%02d", index);
39653963

39663964
if (IS_ERR(dd->mtip_svc_handler)) {
39673965
dev_err(&dd->pdev->dev, "service thread failed to start\n");

0 commit comments

Comments
 (0)