All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix calculation of memory needed for page handles
@ 2012-10-09 17:46 Vincent Penquerc'h
  0 siblings, 0 replies; only message in thread
From: Vincent Penquerc'h @ 2012-10-09 17:46 UTC (permalink / raw)
  To: dri-devel; +Cc: gregkh, Rob Clark

[-- Attachment #1: Type: text/plain, Size: 1319 bytes --]

Hi,

Wrong sizeof used, fixed in attached patch, and below.


>From 7f430a4104bee5f75929580a66128b7b0e2859d9 Mon Sep 17 00:00:00 2001
From: Vincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Date: Tue, 9 Oct 2012 17:18:33 +0100
Subject: [PATCH] drm/omap: fix allocation size for page addresses array

Signed-off-by: Rob Clark <rob@ti.com>
---
 drivers/staging/omapdrm/omap_gem.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/omapdrm/omap_gem.c
b/drivers/staging/omapdrm/omap_gem.c
index c828743..4c1472c 100644
--- a/drivers/staging/omapdrm/omap_gem.c
+++ b/drivers/staging/omapdrm/omap_gem.c
@@ -246,7 +246,7 @@ static int omap_gem_attach_pages(struct
drm_gem_object *obj)
 	 * DSS, GPU, etc. are not cache coherent:
 	 */
 	if (omap_obj->flags & (OMAP_BO_WC|OMAP_BO_UNCACHED)) {
-		addrs = kmalloc(npages * sizeof(addrs), GFP_KERNEL);
+		addrs = kmalloc(npages * sizeof(*addrs), GFP_KERNEL);
 		if (!addrs) {
 			ret = -ENOMEM;
 			goto free_pages;
@@ -257,7 +257,7 @@ static int omap_gem_attach_pages(struct
drm_gem_object *obj)
 					0, PAGE_SIZE, DMA_BIDIRECTIONAL);
 		}
 	} else {
-		addrs = kzalloc(npages * sizeof(addrs), GFP_KERNEL);
+		addrs = kzalloc(npages * sizeof(*addrs), GFP_KERNEL);
 		if (!addrs) {
 			ret = -ENOMEM;
 			goto free_pages;
-- 
1.7.9.5

[-- Attachment #2: 0001-omap_gem-fix-incorrect-allocation-size-for-page-addr.patch --]
[-- Type: text/x-patch, Size: 1153 bytes --]

>From 6a3956290c8473e26047cc9570629fc15ec32cb1 Mon Sep 17 00:00:00 2001
From: Vincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Date: Tue, 9 Oct 2012 17:18:33 +0100
Subject: [PATCH] omap_gem: fix incorrect allocation size for page addresses
 array

---
 drivers/staging/omapdrm/omap_gem.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/omapdrm/omap_gem.c b/drivers/staging/omapdrm/omap_gem.c
index dc308e3..ea072e9 100644
--- a/drivers/staging/omapdrm/omap_gem.c
+++ b/drivers/staging/omapdrm/omap_gem.c
@@ -256,13 +256,13 @@ static int omap_gem_attach_pages(struct drm_gem_object *obj)
 	 * DSS, GPU, etc. are not cache coherent:
 	 */
 	if (omap_obj->flags & (OMAP_BO_WC|OMAP_BO_UNCACHED)) {
-		addrs = kmalloc(npages * sizeof(addrs), GFP_KERNEL);
+		addrs = kmalloc(npages * sizeof(*addrs), GFP_KERNEL);
 		for (i = 0; i < npages; i++) {
 			addrs[i] = dma_map_page(dev->dev, pages[i],
 					0, PAGE_SIZE, DMA_BIDIRECTIONAL);
 		}
 	} else {
-		addrs = kzalloc(npages * sizeof(addrs), GFP_KERNEL);
+		addrs = kzalloc(npages * sizeof(*addrs), GFP_KERNEL);
 	}
 
 	omap_obj->addrs = addrs;
-- 
1.7.9.5


[-- Attachment #3: Type: text/plain, Size: 159 bytes --]

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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-10-09 17:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-09 17:46 [PATCH] Fix calculation of memory needed for page handles Vincent Penquerc'h

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.