From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757610AbcB1VBh (ORCPT ); Sun, 28 Feb 2016 16:01:37 -0500 Received: from mail.kernel.org ([198.145.29.136]:60675 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755176AbcB1VBg (ORCPT ); Sun, 28 Feb 2016 16:01:36 -0500 From: "Luis R. Rodriguez" To: jmorris@namei.org, ming.lei@canonical.com, zohar@linux.vnet.ibm.com Cc: gregkh@linuxfoundation.org, keescook@chromium.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, hkallweit1@gmail.com, nhorman@tuxdriver.com, "Luis R. Rodriguez" Subject: [PATCH v2] firmware: change kernel read fail to dev_dbg() Date: Sun, 28 Feb 2016 13:01:31 -0800 Message-Id: <1456693291-8897-1-git-send-email-mcgrof@kernel.org> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1456614963-5455-1-git-send-email-mcgrof@kernel.org> References: <1456614963-5455-1-git-send-email-mcgrof@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When we now use the new kernel_read_file_from_path() we are reporting a failure when we iterate over all the paths possible for firmware. Before using kernel_read_file_from_path() we only reported a failure once we confirmed a file existed with filp_open() but failed with fw_read_file_contents(). With kernel_read_file_from_path() both are done for us and we obviously are now reporting too much information given that some optional paths will always fail and clutter the logs. fw_get_filesystem_firmware() already has a check for failure and uses an internal flag, FW_OPT_NO_WARN, but this does not let us capture other unxpected errors. This enables that as changed by Neil via commit: "firmware: Be a bit more verbose about direct firmware loading failure" Reported-by: Heiner Kallweit Cc: Neil Horman Cc: Heiner Kallweit Cc: Mimi Zohar Cc: Kees Cook Signed-off-by: Luis R. Rodriguez --- drivers/base/firmware_class.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 1cff832ab74e..9503a88b189b 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c @@ -328,8 +328,12 @@ static int fw_get_filesystem_firmware(struct device *device, rc = kernel_read_file_from_path(path, &buf->data, &size, INT_MAX, READING_FIRMWARE); if (rc) { - dev_warn(device, "loading %s failed with error %d\n", - path, rc); + if (rc == -ENOENT) + dev_dbg(device, "loading %s failed with error %d\n", + path, rc); + else + dev_warn(device, "loading %s failed with error %d\n", + path, rc); continue; } dev_dbg(device, "direct-loading %s\n", buf->fw_id); -- 2.7.0