All of lore.kernel.org
 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 2/5] GPU-DRM-nouveau: Use kmalloc_array() in gt215_link_train()
Date: Wed, 21 Sep 2016 09:25:51 +0200	[thread overview]
Message-ID: <6fcf1d5f-73eb-9107-dc1f-be03a5fef271@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:32: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 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>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c
index d15ea88..dbaf577 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c
@@ -170,7 +170,7 @@ gt215_link_train(struct gt215_ram *ram)
 		return -ENOSYS;
 
 	/* XXX: Multiple partitions? */
-	result = kmalloc(64 * sizeof(u32), GFP_KERNEL);
+	result = kmalloc_array(64, sizeof(*result), GFP_KERNEL);
 	if (!result)
 		return -ENOMEM;
 
-- 
2.10.0

WARNING: multiple messages have this Message-ID (diff)
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: trivial@kernel.org, kernel-janitors@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	Julia Lawall <julia.lawall@lip6.fr>
Subject: [PATCH 2/5] GPU-DRM-nouveau: Use kmalloc_array() in gt215_link_train()
Date: Wed, 21 Sep 2016 07:25:51 +0000	[thread overview]
Message-ID: <6fcf1d5f-73eb-9107-dc1f-be03a5fef271@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:32: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 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>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c
index d15ea88..dbaf577 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c
@@ -170,7 +170,7 @@ gt215_link_train(struct gt215_ram *ram)
 		return -ENOSYS;
 
 	/* XXX: Multiple partitions? */
-	result = kmalloc(64 * sizeof(u32), GFP_KERNEL);
+	result = kmalloc_array(64, sizeof(*result), GFP_KERNEL);
 	if (!result)
 		return -ENOMEM;
 
-- 
2.10.0


WARNING: multiple messages have this Message-ID (diff)
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: trivial@kernel.org, kernel-janitors@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	Julia Lawall <julia.lawall@lip6.fr>
Subject: [PATCH 2/5] GPU-DRM-nouveau: Use kmalloc_array() in gt215_link_train()
Date: Wed, 21 Sep 2016 09:25:51 +0200	[thread overview]
Message-ID: <6fcf1d5f-73eb-9107-dc1f-be03a5fef271@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:32: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 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>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c
index d15ea88..dbaf577 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c
@@ -170,7 +170,7 @@ gt215_link_train(struct gt215_ram *ram)
 		return -ENOSYS;
 
 	/* XXX: Multiple partitions? */
-	result = kmalloc(64 * sizeof(u32), GFP_KERNEL);
+	result = kmalloc_array(64, sizeof(*result), GFP_KERNEL);
 	if (!result)
 		return -ENOMEM;
 
-- 
2.10.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

Thread overview: 24+ 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:23 ` SF Markus Elfring
2016-09-21  7:23 ` SF Markus Elfring
2016-09-21  7:24 ` [PATCH 1/5] GPU-DRM-nouveau: Use kmalloc_array() in nvbios_iccsense_parse() SF Markus Elfring
2016-09-21  7:24   ` SF Markus Elfring
2016-09-21  7:24   ` SF Markus Elfring
2016-09-21  7:25 ` 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:25   ` SF Markus Elfring
2016-09-21  7:26 ` [PATCH 3/5] GPU-DRM-nouveau: Delete unnecessary braces SF Markus Elfring
2016-09-21  7:26   ` SF Markus Elfring
2016-09-21  7:26   ` SF Markus Elfring
     [not found]   ` <74cc2e34-cb5f-e3c9-e6cd-aa24ed3529e3-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
2016-09-21  7:49     ` Roy Spliet
2016-09-21  8:47   ` Dan Carpenter
2016-09-21  8:47     ` Dan Carpenter
2016-09-21 13:20     ` SF Markus Elfring
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:28   ` SF Markus Elfring
2016-09-21  7:28   ` SF Markus Elfring
2016-09-21  7:29 ` [PATCH 5/5] GPU-DRM-nouveau: Add space after an "if" SF Markus Elfring
2016-09-21  7:29   ` SF Markus Elfring
2016-09-21  7:29   ` SF Markus Elfring
     [not found] ` <5bcff2ec-f3bd-ab9c-e13d-3a4f5cf7c73b-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
2016-09-21  8:09   ` [PATCH 0/5] GPU-DRM-nouveau: Fine-tuning for five function implementations Roy Spliet

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=6fcf1d5f-73eb-9107-dc1f-be03a5fef271@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.