Skip to contentSkip to conversation

crypto: ahash - Use GFP_KERNEL on allocation if the request can sleep

PATCH In review Steffen Klassert 2 participants 2 messages Jul 22, 2009 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: ahash - Use GFP_KERNEL on allocation if the request can sleep

ahash_op_unaligned() and ahash_def_finup() allocate memory atomically, regardless whether the request can sleep or not. This patch changes this to use GFP_KERNEL if the request can sleep.

---
 crypto/ahash.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
crypto/ahash.c +2 -2
index 28a33d0..33a4ff4 100644
@@ -223,7 +223,7 @@ static int ahash_op_unaligned(struct ahash_request *req,
 
 	priv = kmalloc(sizeof(*priv) + ahash_align_buffer_size(ds, alignmask),
 		       (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ?
-		       GFP_ATOMIC : GFP_ATOMIC);
+		       GFP_KERNEL : GFP_ATOMIC);
 	if (!priv)
 		return -ENOMEM;
 
@@ -333,7 +333,7 @@ static int ahash_def_finup(struct ahash_request *req)
 
 	priv = kmalloc(sizeof(*priv) + ahash_align_buffer_size(ds, alignmask),
 		       (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ?
-		       GFP_ATOMIC : GFP_ATOMIC);
+		       GFP_KERNEL : GFP_ATOMIC);
 	if (!priv)
 		return -ENOMEM;
 
Signature · 1 line
1.5.4.2
maintainer
#1 lore raw
Quoted 5 lines · Steffen Klassert

ahash_op_unaligned() and ahash_def_finup() allocate memory atomically, regardless whether the request can sleep or not. This patch changes this to use GFP_KERNEL if the request can sleep.

Doh, I don't know what I was thinking when I wrote that :)

Thanks for catching this, I'll apply the patch.

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt