From patchwork Fri Mar 23 19:23:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10305485 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 07A68600CC for ; Fri, 23 Mar 2018 19:31:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECCF12912B for ; Fri, 23 Mar 2018 19:31:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E14602912D; Fri, 23 Mar 2018 19:31:19 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 75FEA2912B for ; Fri, 23 Mar 2018 19:31:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752530AbeCWTbQ (ORCPT ); Fri, 23 Mar 2018 15:31:16 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:41362 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752378AbeCWTbO (ORCPT ); Fri, 23 Mar 2018 15:31:14 -0400 Received: by mail-pl0-f67.google.com with SMTP id b7-v6so8030786plr.8; Fri, 23 Mar 2018 12:31:14 -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=ZSsjXvQgxRItubPbJRfa/894s7hhah/T1TdHyiC5DoE=; b=XcXthgnJ2xNYvY9CQZAFnHxwFDui3EaRn99x4vdbXdL+6PSYZIio8RYouh+iajxFwm UgoS/dZ4iuCeQYU14hRDLYG1zLfsGNfUuevK8p7dUKNXYvClbcpk04avpMHRtb+lSIxo edUIwtsS8AKSqs8BScQPzQ2NFtcCOhTQKPKHslnxwAHWbmhbyVjaAvP7BYzFl8eC4K+W 5VDW9Lafsq7xOS8UJVkdcxPBaJysmZDf8PzQpUqiRJqxUVj8spfrTVisZrER/BDlhaKY lvFM/MxZA2BsgvAptLUSEYVPBBA1bEBjosOwEFUzUaUzFPMLUw7isPUvWIPlOcrvy6O9 Icog== 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=ZSsjXvQgxRItubPbJRfa/894s7hhah/T1TdHyiC5DoE=; b=rhgcSK34/D8Ekj8Wg8rHQlwss8taZINZgpN0ac5Dg+RjeiJtee1TWCzUrj4Zp8p6NG 0xcTk5S7jDlMF77nNts+XfnELgi5jDjpdP1gSTjqC+vrSpisFoyGIsIM9+4/u8W63wWm 4VihYxJFBKefiUG2Dq6beUqfr7uL1xSbrskues7XbCQHmYHOIcoOPNqHo3lr52fowUub PLbGsU1BTMuLvC7It5/hEKEl2eHzsXM1ElCew3ABZLKcod66GU5xyZLwMy3PygaT7eis 3VC2HRYFPXeqyaipTC4cgufwDYAffQ+LH8ErSGSaNtIA0kZ66/ZwkZ0nea+3OKkmZAyN fWWg== X-Gm-Message-State: AElRT7GUbLNPun0e5CcrH6MbwZ8u8opFhIo9p3Sco0ga1PW77d4lUR1H rgaU18lPWLteRaLtjee0Cn/wWvQ2 X-Google-Smtp-Source: AG47ELvDvXKTrK+HsoKOa7Vvjs6kZJrr00wpz5Pd/n7jytIpxyOgV4kpAVId6M7ADhxrUljMfFD3xg== X-Received: by 2002:a17:902:6bc3:: with SMTP id m3-v6mr23466545plt.363.1521833473678; Fri, 23 Mar 2018 12:31:13 -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 x1sm20924545pfk.144.2018.03.23.12.31.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Mar 2018 12:31:13 -0700 (PDT) From: Eric Biggers To: linux-fscrypt@vger.kernel.org, "Theodore Y . Ts'o" Cc: linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org, Jaegeuk Kim , Eric Biggers Subject: [PATCH 02/14] fscrypt: remove error messages for skcipher_request_alloc() failure Date: Fri, 23 Mar 2018 12:23:46 -0700 Message-Id: <20180323192358.95691-3-ebiggers3@gmail.com> X-Mailer: git-send-email 2.17.0.rc0.231.g781580f067-goog In-Reply-To: <20180323192358.95691-1-ebiggers3@gmail.com> References: <20180323192358.95691-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 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 --- fs/crypto/crypto.c | 6 +----- fs/crypto/fname.c | 10 ++-------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/fs/crypto/crypto.c b/fs/crypto/crypto.c index f2b2d8408a01..58761d816751 100644 --- a/fs/crypto/crypto.c +++ b/fs/crypto/crypto.c @@ -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, diff --git a/fs/crypto/fname.c b/fs/crypto/fname.c index e33f3d3c5ade..3b5164b159cb 100644 --- a/fs/crypto/fname.c +++ b/fs/crypto/fname.c @@ -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);