Skip to content

Commit

Permalink
fscrypt: remove error messages for skcipher_request_alloc() failure
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Theodore Ts'o <[email protected]>
  • Loading branch information
ebiggers authored and tytso committed May 20, 2018
1 parent 9919479 commit c90fd77
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
6 changes: 1 addition & 5 deletions fs/crypto/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,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,
Expand Down
10 changes: 2 additions & 8 deletions fs/crypto/fname.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit c90fd77

Please sign in to comment.