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-next>] [day] [month] [year] [list]
Date:	Sat, 13 Feb 2016 20:11:53 +0530
From:	Amitoj Kaur Chawla <amitoj1606@...il.com>
To:	linux-kernel@...r.kernel.org
Cc:	julia.lawall@...6.fr
Subject: [PATCH] goldfish: Return correct error code

The return value of devm_kzalloc on failure of allocation of memory
should be -ENOMEM and not -1.

Found using Coccinelle. A simplified version of the semantic patch
used is:

//<smpl>
@@
expression *e;
@@

e = devm_kzalloc(...);
if (e == NULL) {
...
return
- -1
+ -ENOMEM
;
}
//</smpl>

The single call site does not perform any checks on the return value,
hence no change is required at the call site.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@...il.com>
---
 drivers/platform/goldfish/goldfish_pipe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/goldfish/goldfish_pipe.c b/drivers/platform/goldfish/goldfish_pipe.c
index e7a29e2..f15e3c9 100644
--- a/drivers/platform/goldfish/goldfish_pipe.c
+++ b/drivers/platform/goldfish/goldfish_pipe.c
@@ -222,7 +222,7 @@ static int setup_access_params_addr(struct platform_device *pdev,
 
 	aps = devm_kzalloc(&pdev->dev, sizeof(struct access_params), GFP_KERNEL);
 	if (!aps)
-		return -1;
+		return -ENOMEM;
 
 	/* FIXME */
 	paddr = __pa(aps);
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ