linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org,
	Ben Skeggs <bskeggs@redhat.com>, David Airlie <airlied@linux.ie>,
	Martin Peres <martin.peres@free.fr>,
	Roy Spliet <rspliet@eclipso.eu>
Cc: LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org, trivial@kernel.org,
	Julia Lawall <julia.lawall@lip6.fr>
Subject: [PATCH 1/5] GPU-DRM-nouveau: Use kmalloc_array() in nvbios_iccsense_parse()
Date: Wed, 21 Sep 2016 09:24:52 +0200	[thread overview]
Message-ID: <77983748-8b67-5ee1-e94b-5f3b8c221ad0@users.sourceforge.net> (raw)
In-Reply-To: <5bcff2ec-f3bd-ab9c-e13d-3a4f5cf7c73b@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 20 Sep 2016 22:22:14 +0200

* 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 structure 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>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/bios/iccsense.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/iccsense.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/iccsense.c
index 0843280..91cf1ee 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/iccsense.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/iccsense.c
@@ -72,7 +72,9 @@ nvbios_iccsense_parse(struct nvkm_bios *bios, struct nvbios_iccsense *iccsense)
 	}
 
 	iccsense->nr_entry = cnt;
-	iccsense->rail = kmalloc(sizeof(struct pwr_rail_t) * cnt, GFP_KERNEL);
+	iccsense->rail = kmalloc_array(cnt,
+				       sizeof(*iccsense->rail),
+				       GFP_KERNEL);
 	if (!iccsense->rail)
 		return -ENOMEM;
 
-- 
2.10.0

  reply	other threads:[~2016-09-21  7:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-21  7:23 [PATCH 0/5] GPU-DRM-nouveau: Fine-tuning for five function implementations SF Markus Elfring
2016-09-21  7:24 ` SF Markus Elfring [this message]
2016-09-21  7:25 ` [PATCH 2/5] GPU-DRM-nouveau: Use kmalloc_array() in gt215_link_train() SF Markus Elfring
2016-09-21  7:26 ` [PATCH 3/5] GPU-DRM-nouveau: Delete unnecessary braces SF Markus Elfring
2016-09-21  8:47   ` Dan Carpenter
2016-09-21 13:20     ` SF Markus Elfring
2016-09-21  7:28 ` [PATCH 4/5] GPU-DRM-nouveau: Adjust a kzalloc() call in gt215_ram_new() SF Markus Elfring
2016-09-21  7:29 ` [PATCH 5/5] GPU-DRM-nouveau: Add space after an "if" SF Markus Elfring

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=77983748-8b67-5ee1-e94b-5f3b8c221ad0@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=airlied@linux.ie \
    --cc=bskeggs@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=julia.lawall@lip6.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.peres@free.fr \
    --cc=nouveau@lists.freedesktop.org \
    --cc=rspliet@eclipso.eu \
    --cc=trivial@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).