[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160204211501.GA14755@www.outflux.net>
Date: Thu, 4 Feb 2016 13:15:02 -0800
From: Kees Cook <keescook@...omium.org>
To: Mimi Zohar <zohar@...ux.vnet.ibm.com>
Cc: "Luis R. Rodriguez" <mcgrof@...nel.org>,
Josh Boyer <jwboyer@...oraproject.org>,
David Howells <dhowells@...hat.com>,
linux-kernel@...r.kernel.org,
David Woodhouse <dwmw2@...radead.org>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Dmitry Kasatkin <dmitry.kasatkin@...il.com>,
Eric Biederman <ebiederm@...ssion.com>,
Rusty Russell <rusty@...tcorp.com.au>,
linux-security-module@...r.kernel.org, kexec@...ts.infradead.org,
linux-modules@...r.kernel.org
Subject: [PATCH v3.1] firmware: clean up filesystem load exit path
This makes the error and success paths more readable while trying to
load firmware from the filesystem.
Signed-off-by: Kees Cook <keescook@...omium.org>
Cc: Josh Boyer <jwboyer@...oraproject.org>
Cc: David Howells <dhowells@...hat.com>
Cc: Luis R. Rodriguez <mcgrof@...nel.org>
Cc: Mimi Zohar <zohar@...ux.vnet.ibm.com>
---
Suggested as an alternative to "[PATCH v3 06/22] firmware: fold successful fw read early"
---
drivers/base/firmware_class.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 62e052b50aa9..484afbd783f8 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -352,19 +352,17 @@ static int fw_get_filesystem_firmware(struct device *device,
continue;
rc = fw_read_file_contents(file, buf);
fput(file);
- if (rc)
+ if (rc) {
dev_warn(device, "loading %s failed with error %d\n",
path, rc);
- else
- break;
- }
- __putname(path);
-
- if (!rc) {
+ continue;
+ }
dev_dbg(device, "direct-loading %s\n",
buf->fw_id);
fw_finish_direct_load(device, buf);
+ break;
}
+ __putname(path);
return rc;
}
--
2.6.3
--
Kees Cook
Chrome OS & Brillo Security
Powered by blists - more mailing lists