2006-11-03 19:51:28

by Florin Malita

[permalink] [raw]
Subject: [PATCH] ecryptfs: bad allocation result check

The kmalloc() result in* *ecryptfs_crypto_api_algify_cipher_name() is
assigned to an indirectly referenced pointer and not to the pointer
itself, so the current result check is incorrect.

Signed-off-by: Florin Malita <[email protected]>
---

crypto.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index f49f105..136175a 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -134,7 +134,7 @@ int ecryptfs_crypto_api_algify_cipher_na

algified_name_len = (chaining_modifier_len + cipher_name_len + 3);
(*algified_name) = kmalloc(algified_name_len, GFP_KERNEL);
- if (!(algified_name)) {
+ if (!(*algified_name)) {
rc = -ENOMEM;
goto out;
}



2006-11-03 20:02:09

by Michael Halcrow

[permalink] [raw]
Subject: Re: [PATCH] ecryptfs: bad allocation result check

On Fri, Nov 03, 2006 at 02:51:22PM -0500, Florin Malita wrote:
> The kmalloc() result in* *ecryptfs_crypto_api_algify_cipher_name()
> is assigned to an indirectly referenced pointer and not to the
> pointer itself, so the current result check is incorrect.

Thanks; this bug was already caught and fixed.