fscrypt: remove error messages for skcipher_request_alloc() failure
authorEric Biggers <ebiggers@google.com>
Mon, 30 Apr 2018 22:51:38 +0000 (15:51 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Thu, 28 Jun 2018 16:37:40 +0000 (09:37 -0700)
skcipher_request_alloc() can only fail due to lack of memory, and in
that case the memory allocator will have already printed a detailed
error message.  Thus, remove the redundant error messages from fscrypt.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/crypto/crypto.c
fs/crypto/fname.c

index a00efa266eb5f21cc935037fd242f5b230d0925d..021f348900b1f1a49c2953639074e85522dba72e 100644 (file)
@@ -162,12 +162,8 @@ int fscrypt_do_page_crypto(const struct inode *inode, fscrypt_direction_t rw,
        }
 
        req = skcipher_request_alloc(tfm, gfp_flags);
-       if (!req) {
-               printk_ratelimited(KERN_ERR
-                               "%s: crypto_request_alloc() failed\n",
-                               __func__);
+       if (!req)
                return -ENOMEM;
-       }
 
        skcipher_request_set_callback(
                req, CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP,
index e33f3d3c5ade8ce6e647e6b5021f7e51f00a96c1..3b5164b159cba2f9b48e7596f57fd258756de7d2 100644 (file)
@@ -59,11 +59,8 @@ int fname_encrypt(struct inode *inode, const struct qstr *iname,
 
        /* Set up the encryption request */
        req = skcipher_request_alloc(tfm, GFP_NOFS);
-       if (!req) {
-               printk_ratelimited(KERN_ERR
-                       "%s: skcipher_request_alloc() failed\n", __func__);
+       if (!req)
                return -ENOMEM;
-       }
        skcipher_request_set_callback(req,
                        CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP,
                        crypto_req_done, &wait);
@@ -108,11 +105,8 @@ static int fname_decrypt(struct inode *inode,
 
        /* Allocate request */
        req = skcipher_request_alloc(tfm, GFP_NOFS);
-       if (!req) {
-               printk_ratelimited(KERN_ERR
-                       "%s: crypto_request_alloc() failed\n",  __func__);
+       if (!req)
                return -ENOMEM;
-       }
        skcipher_request_set_callback(req,
                CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP,
                crypto_req_done, &wait);