From patchwork Mon Apr 30 22:51:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10373047 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 ED5E56032A for ; Mon, 30 Apr 2018 22:57:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA63E1FF83 for ; Mon, 30 Apr 2018 22:57:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CEFC1212DA; Mon, 30 Apr 2018 22:57:13 +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 71B371FF83 for ; Mon, 30 Apr 2018 22:57:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755345AbeD3W5J (ORCPT ); Mon, 30 Apr 2018 18:57:09 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:38997 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755285AbeD3W4n (ORCPT ); Mon, 30 Apr 2018 18:56:43 -0400 Received: by mail-pg0-f65.google.com with SMTP id b9-v6so7260318pgf.6; Mon, 30 Apr 2018 15:56:43 -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=8pjpcrDcRhTWN81wgd1CvnzrziUVBWC2eSR6J45++fc=; b=Oabb1lcSY7kJJQO5Lv+rBTMOVNoXrxzD/35o6kvTjDjPoMcmXeQSmHL6/M0ELxEG07 OlqAcwaAoU7wPtDH6vdCQfH6M9MnJuvap1Ky4HPvsw2qrdpS5rhviQxzAR8M0i+yx4QH tuKB5ndYGyAeR4j3Lj+ert3TOti4ST/9+dvezlVBIBs+DNHRUpwmMOrt8ehjyAAaY/x+ akQtxFObwy4QvqrfUgiu3ZPVJp5CGx1fDO1hqK+GZ/z2vx6wduxoCRtD4SriQpUY1RyH gS5OJEmoPJT/W7R/PVZN3mnG+W+NKxIRmHfqpYjxVuKvHqA5NQH4DJTo+dexRwWnOlFx Kf/Q== 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=8pjpcrDcRhTWN81wgd1CvnzrziUVBWC2eSR6J45++fc=; b=i2YJ2sn46mPwm1OvQuTtnRaVh2KiJKMB2i+5gkGATuKzakghC2CKZYYoZyro/vQ9nq AvBLJWI44k4VbwpmfWN1D4BTT7S+5/BXW/1EnE5UTpSKX9mRzltzDZCXzAgLR3F5fY3q /v8Z/WQDVZWiaI4cZQ2l/qzLWyMjaCy9E/FPxB5FO/YM7/h1ann/0HLp1vmjP9jPsABk Vh7EkgmtThbI/tHzOjRiFtpAABcRoVPYZhjHyIq5JJA7WOoiiR5Xr5mGqPxpCKFASJAj ECQzGiWUTV6X+eehKhvWdjs2mwffDj89fITkWXXxNOQFSB2y/hs0b0U5odRG4FiibZ0S 64pA== X-Gm-Message-State: ALQs6tAPC+H/WCK6/NyrIcKPttbbVDkLTpL9ADcIUiZ91/6BWC0wl2+4 i+kyZBtC/a7RAcam7YEGaUx8Av2h X-Google-Smtp-Source: AB8JxZo55lgWiCntKO9sqhh7/M6enmN/RXdW+vReWqZpU0tS9qJTketiBddY3GCjKM8NSfaEpfdTig== X-Received: by 2002:a63:7058:: with SMTP id a24-v6mr11607129pgn.101.1525129002629; Mon, 30 Apr 2018 15:56:42 -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.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Apr 2018 15:56:41 -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 04/15] fscrypt: remove error messages for skcipher_request_alloc() failure Date: Mon, 30 Apr 2018 15:51:38 -0700 Message-Id: <20180430225149.183514-5-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 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);