From patchwork Mon Apr 30 22:51:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10373045 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9AC146032A for ; Mon, 30 Apr 2018 22:57:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 898F21FF83 for ; Mon, 30 Apr 2018 22:57:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E38A212DA; Mon, 30 Apr 2018 22:57:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E8E81FF83 for ; Mon, 30 Apr 2018 22:57:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755285AbeD3W5K (ORCPT ); Mon, 30 Apr 2018 18:57:10 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:37333 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755283AbeD3W4m (ORCPT ); Mon, 30 Apr 2018 18:56:42 -0400 Received: by mail-pg0-f68.google.com with SMTP id a13-v6so7263358pgu.4; Mon, 30 Apr 2018 15:56:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XvOWIjmOn0PxA7PdXbWqhqHx2trNuJonWONBF3x8FS4=; b=fQUZ/Qk0NqEC3woI/gH6u5IpjHXqGoq79w7U/VYyBnPg+8LRSfB7+JhKkeVyOOqm2M eeenAV+SkWGkSs7sxyH7uj8h9Xh9XYs8n6F2T5RyAz7kjFV3Vz48UkUOB5fp/GMH2i56 HrqymBYWWEpGtIK5UvDD4hLhW+Q1reZxxtb1FbW8vbUe5/SjNgDIZnQ4Bw40kyrCZzg7 dPlZ8u9j61XFts8AJ9T9tJv2zvvxiCQvwtZ2ww3Uas+Xizui0L62ZtQiTvX2KpNdxZPi 8Ujfiryp2kthn4aVZOi7UmvUie310QTLA8d//7Jk2JXzlXWjuBlIFuk1Jni8kky73Pnm QAdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XvOWIjmOn0PxA7PdXbWqhqHx2trNuJonWONBF3x8FS4=; b=WluMroHmcvlu9AK55oao9R5fdm7zKETT0BwYmlM2ZCHBT7eM3GKHXMSqo4lFoYfx6O ZOA5IE9zi3wqDEyJ1YR7vAECrOw1KsRyyb6baw9HGszQeOBvAaBmhgc9q4guz4OJJfOQ QTbytsNxYO5QnqwR/vdAozqiX0iz3HQrbRBpOkkZ0/NVe9g0KpJu1x8NW6/YUvAfdXVg SBlLbgTPZ/IEp0BqtMqJ3Tp8oF44Llx4OAgD4/9q2nn/e1y6fpdQLTt8fCJyu7MdImPc /WMQPAe+zOxsFHXzRr5VGkqhlXLVTAotIMfRXhnP3Mhkiebx15tWRoZhj867ZinupbOF I8Bw== X-Gm-Message-State: ALQs6tA08CjMEuHzWf+Sx6suvxwtjN0gs+xYI25Be/s8Kpvwsm8rtwF3 Wz3gKPYNy6ga0lH+PBGeH5EYSeII X-Google-Smtp-Source: AB8JxZqFkV4nosJCTFcyFKEjHPOorxZetUXF+yhDrOhF90BeiOU834syEQzHf2iebdxgi9++pI4IKw== X-Received: by 2002:a65:48c9:: with SMTP id o9-v6mr10990304pgs.390.1525129001733; Mon, 30 Apr 2018 15:56:41 -0700 (PDT) Received: from ebiggers-linuxstation.kir.corp.google.com ([2620:15c:17:3:dc28:5c82:b905:e8a8]) by smtp.gmail.com with ESMTPSA id b15sm12969305pfi.111.2018.04.30.15.56.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Apr 2018 15:56:40 -0700 (PDT) From: Eric Biggers To: linux-fscrypt@vger.kernel.org, "Theodore Y . Ts'o" Cc: Jaegeuk Kim , linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org, Eric Biggers Subject: [PATCH 03/15] fscrypt: remove unnecessary NULL check when allocating skcipher Date: Mon, 30 Apr 2018 15:51:37 -0700 Message-Id: <20180430225149.183514-4-ebiggers3@gmail.com> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: <20180430225149.183514-1-ebiggers3@gmail.com> References: <20180430225149.183514-1-ebiggers3@gmail.com> Sender: linux-fscrypt-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Biggers crypto_alloc_skcipher() returns an ERR_PTR() on failure, not NULL. Remove the unnecessary check for NULL. Signed-off-by: Eric Biggers --- fs/crypto/keyinfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/crypto/keyinfo.c b/fs/crypto/keyinfo.c index 05f5ee1f0705..d09df8f751df 100644 --- a/fs/crypto/keyinfo.c +++ b/fs/crypto/keyinfo.c @@ -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;