crypto: rsa-pkcs1pad - Replace GFP_ATOMIC with GFP_KERNEL in pkcs1pad_encrypt_sign_co...
authorJia-Ju Bai <baijiaju1990@gmail.com>
Thu, 25 Jan 2018 09:57:54 +0000 (17:57 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 15 Feb 2018 15:26:47 +0000 (23:26 +0800)
After checking all possible call chains to kzalloc here,
my tool finds that this kzalloc is never called in atomic context.
Thus GFP_ATOMIC is not necessary, and it can be replaced with GFP_KERNEL.

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/rsa-pkcs1pad.c

index 2908f93c3e554482b0e4ca1d2061a9dac2910438..9893dbfc1af4524fdea9a0f2d6aa1b225534cde7 100644 (file)
@@ -192,7 +192,7 @@ static int pkcs1pad_encrypt_sign_complete(struct akcipher_request *req, int err)
        if (likely(!pad_len))
                goto out;
 
-       out_buf = kzalloc(ctx->key_size, GFP_ATOMIC);
+       out_buf = kzalloc(ctx->key_size, GFP_KERNEL);
        err = -ENOMEM;
        if (!out_buf)
                goto out;