]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
fscrypt: remove unnecessary NULL check when allocating skcipher
authorEric Biggers <ebiggers@google.com>
Mon, 30 Apr 2018 22:51:37 +0000 (15:51 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 20 May 2018 20:21:00 +0000 (16:21 -0400)
crypto_alloc_skcipher() returns an ERR_PTR() on failure, not NULL.
Remove the unnecessary check for NULL.

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

index 05f5ee1f07057ab6484c84c4dc4b66d0f3a1e934..d09df8f751df047d2c5d5b826e61cf2f295c6c50 100644 (file)
@@ -318,8 +318,8 @@ int fscrypt_get_encryption_info(struct inode *inode)
                goto out;
        }
        ctfm = crypto_alloc_skcipher(cipher_str, 0, 0);
-       if (!ctfm || IS_ERR(ctfm)) {
-               res = ctfm ? PTR_ERR(ctfm) : -ENOMEM;
+       if (IS_ERR(ctfm)) {
+               res = PTR_ERR(ctfm);
                pr_debug("%s: error %d (inode %lu) allocating crypto tfm\n",
                         __func__, res, inode->i_ino);
                goto out;