linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Markus Elfring <elfring@users.sourceforge.net>
Cc: Mark Brown <broonie@kernel.org>,
	linux-spi@vger.kernel.org, Mark Brown <broonie@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org, linux-spi@vger.kernel.org
Subject: Applied "spi/mpc52xx: Use kmalloc_array() in mpc52xx_spi_probe()" to the spi tree
Date: Tue, 17 Jan 2017 18:46:03 +0000	[thread overview]
Message-ID: <E1cTYlf-0000ON-Nl@debutante> (raw)
In-Reply-To: <eb433c31-35b0-14a6-8ded-6b14ba8752c2@users.sourceforge.net>

The patch

   spi/mpc52xx: Use kmalloc_array() in mpc52xx_spi_probe()

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 8b6c8955b5dc21358cb1f67cadc5514d2353375d Mon Sep 17 00:00:00 2001
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 13 Jan 2017 14:06:10 +0100
Subject: [PATCH] spi/mpc52xx: Use kmalloc_array() in mpc52xx_spi_probe()

* A multiplication for the size determination of a memory allocation
  indicated that an array data structure should be processed.
  Thus use the corresponding function "kmalloc_array".

  This issue was detected by using the Coccinelle software.

* Replace the specification of a data type by a pointer dereference
  to make the corresponding size determination a bit safer according to
  the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-mpc52xx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-mpc52xx.c b/drivers/spi/spi-mpc52xx.c
index c36002110c30..8cc129efe7ba 100644
--- a/drivers/spi/spi-mpc52xx.c
+++ b/drivers/spi/spi-mpc52xx.c
@@ -437,8 +437,9 @@ static int mpc52xx_spi_probe(struct platform_device *op)
 	ms->gpio_cs_count = of_gpio_count(op->dev.of_node);
 	if (ms->gpio_cs_count > 0) {
 		master->num_chipselect = ms->gpio_cs_count;
-		ms->gpio_cs = kmalloc(ms->gpio_cs_count * sizeof(unsigned int),
-				GFP_KERNEL);
+		ms->gpio_cs = kmalloc_array(ms->gpio_cs_count,
+					    sizeof(*ms->gpio_cs),
+					    GFP_KERNEL);
 		if (!ms->gpio_cs) {
 			rc = -ENOMEM;
 			goto err_alloc_gpio;
-- 
2.11.0

  reply	other threads:[~2017-01-17 18:46 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-13 17:05 [PATCH 00/17] SPI: Fine-tuning for several function implementations SF Markus Elfring
2017-01-13 17:07 ` [PATCH 01/17] spi: Use kcalloc() in spi_register_board_info() SF Markus Elfring
2017-01-17 18:46   ` Applied "spi: Use kcalloc() in spi_register_board_info()" to the spi tree Mark Brown
2017-01-13 17:09 ` [PATCH 02/17] spi: Adjust checks for null pointers in two functions SF Markus Elfring
2017-01-17 18:21   ` Mark Brown
2017-01-13 17:11 ` [PATCH 03/17] spi: fsl: Use kcalloc() in of_fsl_spi_get_chipselects() SF Markus Elfring
2017-01-17 18:46   ` Applied "spi: fsl: Use kcalloc() in of_fsl_spi_get_chipselects()" to the spi tree Mark Brown
2017-01-13 17:12 ` [PATCH 04/17] spi: fsl: Use kmalloc_array() in of_fsl_spi_get_chipselects() SF Markus Elfring
2017-01-17 18:27   ` Mark Brown
2017-01-17 18:46   ` Applied "spi: fsl: Use kmalloc_array() in of_fsl_spi_get_chipselects()" to the spi tree Mark Brown
2017-01-13 17:13 ` [PATCH 05/17] spi: fsl: Combine substrings for two messages SF Markus Elfring
2017-01-17 18:46   ` Applied "spi: fsl: Combine substrings for two messages" to the spi tree Mark Brown
2017-01-13 17:14 ` [PATCH 06/17] spi/mpc52xx: Use kmalloc_array() in mpc52xx_spi_probe() SF Markus Elfring
2017-01-17 18:46   ` Mark Brown [this message]
2017-01-13 17:15 ` [PATCH 07/17] spi/mpc52xx: Combine substrings for two messages SF Markus Elfring
2017-01-17 18:33   ` Mark Brown
2017-01-17 18:46   ` Applied "spi/mpc52xx: Combine substrings for two messages" to the spi tree Mark Brown
2017-01-13 17:16 ` [PATCH 08/17] spi/ppc4xx: Use kcalloc() in spi_ppc4xx_of_probe() SF Markus Elfring
2017-01-17 18:45   ` Applied "spi/ppc4xx: Use kcalloc() in spi_ppc4xx_of_probe()" to the spi tree Mark Brown
2017-01-13 17:18 ` [PATCH 09/17] spi/ppc4xx: Combine substrings for a message in spi_ppc4xx_of_probe() SF Markus Elfring
2017-01-17 18:45   ` Applied "spi/ppc4xx: Combine substrings for a message in spi_ppc4xx_of_probe()" to the spi tree Mark Brown
2017-01-13 17:19 ` [PATCH 10/17] spi/ppc4xx: Adjust checks for null pointers in two functions SF Markus Elfring
2017-01-17 18:34   ` Mark Brown
2017-01-17 18:48     ` SF Markus Elfring
2017-01-17 19:11       ` Mark Brown
2017-01-17 19:28         ` SF Markus Elfring
2017-01-17 19:37           ` Mark Brown
2017-01-13 17:20 ` [PATCH 11/17] spi/topcliff-pch: Use kcalloc() in pch_spi_handle_dma() SF Markus Elfring
2017-01-17 18:45   ` Applied "spi/topcliff-pch: Use kcalloc() in pch_spi_handle_dma()" to the spi tree Mark Brown
2017-01-13 17:21 ` [PATCH 12/17] spi/topcliff-pch: Improve size determinations in pch_spi_probe() SF Markus Elfring
2017-01-17 18:45   ` Applied "spi/topcliff-pch: Improve size determinations in pch_spi_probe()" to the spi tree Mark Brown
2017-01-13 17:23 ` [PATCH 13/17] spi/topcliff-pch: Delete an unnecessary return statement in two functions SF Markus Elfring
2017-01-17 18:45   ` Applied "spi/topcliff-pch: Delete an unnecessary return statement in two functions" to the spi tree Mark Brown
2017-01-13 17:24 ` [PATCH 14/17] spi/topcliff-pch: Adjust six checks for null pointers SF Markus Elfring
2017-01-14  6:36   ` Dan Carpenter
2017-01-13 17:25 ` [PATCH 15/17] spi/topcliff-pch: Combine substrings for four messages SF Markus Elfring
2017-01-17 18:45   ` Applied "spi/topcliff-pch: Combine substrings for four messages" to the spi tree Mark Brown
2017-01-13 17:27 ` [PATCH 16/17] spi/topcliff-pch: Delete an error message for a failed memory allocation in pch_spi_set_tx() SF Markus Elfring
2017-01-17 18:45   ` Applied "spi/topcliff-pch: Delete an error message for a failed memory allocation in pch_spi_set_tx()" to the spi tree Mark Brown
2017-01-13 17:28 ` [PATCH 17/17] spi/topcliff-pch: One check less in pch_spi_set_tx() SF Markus Elfring
2017-01-13 18:16   ` Geert Uytterhoeven

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=E1cTYlf-0000ON-Nl@debutante \
    --to=broonie@kernel.org \
    --cc=elfring@users.sourceforge.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).