Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1163069AbbKTPaE (ORCPT ); Fri, 20 Nov 2015 10:30:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37287 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162980AbbKTPaB (ORCPT ); Fri, 20 Nov 2015 10:30:01 -0500 From: Jeff Moyer To: Rasmus Villemoes Cc: Jens Axboe , Asai Thambi SP , linux-kernel@vger.kernel.org Subject: Re: [PATCH] mtip32xx: use formatting capability of kthread_create_on_node References: <1448012809-15462-1-git-send-email-linux@rasmusvillemoes.dk> X-PGP-KeyID: 1F78E1B4 X-PGP-CertKey: F6FE 280D 8293 F72C 65FD 5A58 1FF8 A7CA 1F78 E1B4 X-PCLoadLetter: What the f**k does that mean? Date: Fri, 20 Nov 2015 10:29:59 -0500 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") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1813 Lines: 47 Rasmus Villemoes 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 > Signed-off-by: Rasmus Villemoes > --- > 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"); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/