[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <77983748-8b67-5ee1-e94b-5f3b8c221ad0@users.sourceforge.net>
Date: Wed, 21 Sep 2016 09:24:52 +0200
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: dri-devel@...ts.freedesktop.org, nouveau@...ts.freedesktop.org,
Ben Skeggs <bskeggs@...hat.com>,
David Airlie <airlied@...ux.ie>,
Martin Peres <martin.peres@...e.fr>,
Roy Spliet <rspliet@...ipso.eu>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org, trivial@...nel.org,
Julia Lawall <julia.lawall@...6.fr>
Subject: [PATCH 1/5] GPU-DRM-nouveau: Use kmalloc_array() in
nvbios_iccsense_parse()
From: Markus Elfring <elfring@...rs.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@...rs.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
Powered by blists - more mailing lists