lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 09 Dec 2016 14:05:30 +0900
From:   Jaewon Kim <jaewon31.kim@...sung.com>
To:     gregkh@...uxfoundation.org
Cc:     labbott@...hat.com, sumit.semwal@...aro.org, tixy@...aro.org,
        prime.zeng@...wei.com, tranmanphong@...il.com,
        fabio.estevam@...escale.com, ccross@...roid.com,
        rebecca@...roid.com, benjamin.gaignard@...aro.org,
        arve@...roid.com, riandrews@...roid.com, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, jaewon31.kim@...il.com,
        Jaewon Kim <jaewon31.kim@...sung.com>
Subject: [PATCH] staging: android: ion: return -ENOMEM in ion_cma_heap
 allocation failure

Initial Commit 349c9e138551 ("gpu: ion: add CMA heap") returns -1 in allocation
failure. The returned value is passed up to userspace through ioctl. So user can
misunderstand error reason as -EPERM(1) rather than -ENOMEM(12).

This patch simply changed this to return -ENOMEM.

Signed-off-by: Jaewon Kim <jaewon31.kim@...sung.com>
---
 drivers/staging/android/ion/ion_cma_heap.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/android/ion/ion_cma_heap.c b/drivers/staging/android/ion/ion_cma_heap.c
index 6c7de74..22b9582 100644
--- a/drivers/staging/android/ion/ion_cma_heap.c
+++ b/drivers/staging/android/ion/ion_cma_heap.c
@@ -24,8 +24,6 @@
 #include "ion.h"
 #include "ion_priv.h"
 
-#define ION_CMA_ALLOCATE_FAILED -1
-
 struct ion_cma_heap {
 	struct ion_heap heap;
 	struct device *dev;
@@ -59,7 +57,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
 
 	info = kzalloc(sizeof(struct ion_cma_buffer_info), GFP_KERNEL);
 	if (!info)
-		return ION_CMA_ALLOCATE_FAILED;
+		return -ENOMEM;
 
 	info->cpu_addr = dma_alloc_coherent(dev, len, &(info->handle),
 						GFP_HIGHUSER | __GFP_ZERO);
@@ -88,7 +86,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
 	dma_free_coherent(dev, len, info->cpu_addr, info->handle);
 err:
 	kfree(info);
-	return ION_CMA_ALLOCATE_FAILED;
+	return -ENOMEM;
 }
 
 static void ion_cma_free(struct ion_buffer *buffer)
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ