From: Jeff Moyer <jmoyer@redhat.com>
To: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Jens Axboe <axboe@fb.com>,
Asai Thambi SP <asamymuthupa@micron.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtip32xx: use formatting capability of kthread_create_on_node
Date: Fri, 20 Nov 2015 10:29:59 -0500 [thread overview]
Message-ID: <x49ziy8d6yw.fsf@segfault.boston.devel.redhat.com> (raw)
In-Reply-To: <1448012809-15462-1-git-send-email-linux@rasmusvillemoes.dk> (Rasmus Villemoes's message of "Fri, 20 Nov 2015 10:46:49 +0100")
Rasmus Villemoes <linux@rasmusvillemoes.dk> writes:
> 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.
I don't know of any systems with enough pci slots to expand index
beyond 99. However, the patch looks like a good cleanup to me.
Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> ---
> drivers/block/mtip32xx/mtip32xx.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
> index a28a562f7b7f..3457ac8c03e2 100644
> --- a/drivers/block/mtip32xx/mtip32xx.c
> +++ b/drivers/block/mtip32xx/mtip32xx.c
> @@ -3810,7 +3810,6 @@ static int mtip_block_initialize(struct driver_data *dd)
> sector_t capacity;
> unsigned int index = 0;
> struct kobject *kobj;
> - unsigned char thd_name[16];
>
> if (dd->disk)
> goto skip_create_disk; /* hw init done, before rebuild */
> @@ -3958,10 +3957,9 @@ skip_create_disk:
> }
>
> start_service_thread:
> - sprintf(thd_name, "mtip_svc_thd_%02d", index);
> dd->mtip_svc_handler = kthread_create_on_node(mtip_service_thread,
> - dd, dd->numa_node, "%s",
> - thd_name);
> + dd, dd->numa_node,
> + "mtip_svc_thd_%02d", index);
>
> if (IS_ERR(dd->mtip_svc_handler)) {
> dev_err(&dd->pdev->dev, "service thread failed to start\n");
next prev parent reply other threads:[~2015-11-20 15:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-20 9:46 Rasmus Villemoes
2015-11-20 15:29 ` Jeff Moyer [this message]
2015-11-20 18:35 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=x49ziy8d6yw.fsf@segfault.boston.devel.redhat.com \
--to=jmoyer@redhat.com \
--cc=asamymuthupa@micron.com \
--cc=axboe@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®