]> git.baikalelectronics.ru Git - kernel.git/commit
fs/ecryptfs: Return -ENOMEM on memory allocation failure
authorJulia Lawall <julia@diku.dk>
Wed, 11 Aug 2010 10:11:41 +0000 (12:11 +0200)
committerTyler Hicks <tyhicks@linux.vnet.ibm.com>
Fri, 27 Aug 2010 15:50:52 +0000 (10:50 -0500)
commitf3587ea572c14e7839fb71f53d6bda08f4965785
treea1679017c58f65b7fd20febab16bb338354bd59b
parentf5c0033f69afbff43f405397eac3835ae237bbd2
fs/ecryptfs: Return -ENOMEM on memory allocation failure

In this code, 0 is returned on memory allocation failure, even though other
failures return -ENOMEM or other similar values.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression ret;
expression x,e1,e2,e3;
@@

ret = 0
... when != ret = e1
*x = \(kmalloc\|kcalloc\|kzalloc\)(...)
... when != ret = e2
if (x == NULL) { ... when != ret = e3
  return ret;
}
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
fs/ecryptfs/keystore.c