[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ec326654-c43b-259c-409c-63929ad5b217@broadcom.com>
Date: Tue, 21 Jul 2020 14:43:07 -0700
From: Scott Branden <scott.branden@...adcom.com>
To: Kees Cook <keescook@...omium.org>
Cc: Mimi Zohar <zohar@...ux.ibm.com>,
Matthew Wilcox <willy@...radead.org>,
James Morris <jmorris@...ei.org>,
Luis Chamberlain <mcgrof@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
Jessica Yu <jeyu@...nel.org>,
Dmitry Kasatkin <dmitry.kasatkin@...il.com>,
"Serge E. Hallyn" <serge@...lyn.com>,
Casey Schaufler <casey@...aufler-ca.com>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Peter Zijlstra <peterz@...radead.org>,
Matthew Garrett <matthewgarrett@...gle.com>,
David Howells <dhowells@...hat.com>,
Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
Randy Dunlap <rdunlap@...radead.org>,
"Joel Fernandes (Google)" <joel@...lfernandes.org>,
KP Singh <kpsingh@...gle.com>, Dave Olsthoorn <dave@...aar.me>,
Hans de Goede <hdegoede@...hat.com>,
Peter Jones <pjones@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Stephen Boyd <stephen.boyd@...aro.org>,
Paul Moore <paul@...l-moore.com>,
Stephen Smalley <stephen.smalley.work@...il.com>,
linux-security-module@...r.kernel.org,
linux-integrity@...r.kernel.org, selinux@...r.kernel.org,
linux-fsdevel@...r.kernel.org, kexec@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 06/13] fs/kernel_read_file: Remove redundant size argument
Hi Kees,
On 2020-07-17 10:43 a.m., Kees Cook wrote:
> In preparation for refactoring kernel_read_file*(), remove the redundant
> "size" argument which is not needed: it can be included in the return
> code, with callers adjusted. (VFS reads already cannot be larger than
> INT_MAX.)
>
> Signed-off-by: Kees Cook <keescook@...omium.org>
> ---
> drivers/base/firmware_loader/main.c | 8 ++++----
> fs/kernel_read_file.c | 20 +++++++++-----------
> include/linux/kernel_read_file.h | 8 ++++----
> kernel/kexec_file.c | 13 ++++++-------
> kernel/module.c | 7 +++----
> security/integrity/digsig.c | 5 +++--
> security/integrity/ima/ima_fs.c | 5 +++--
> 7 files changed, 32 insertions(+), 34 deletions(-)
>
> diff --git a/drivers/base/firmware_loader/main.c b/drivers/base/firmware_loader/main.c
> index d4a413ea48ce..ea419c7d3d34 100644
> --- a/drivers/base/firmware_loader/main.c
> +++ b/drivers/base/firmware_loader/main.c
> @@ -462,7 +462,7 @@ fw_get_filesystem_firmware(struct device *device, struct fw_priv *fw_priv,
> size_t in_size,
> const void *in_buffer))
> {
> - loff_t size;
> + size_t size;
> int i, len;
> int rc = -ENOENT;
> char *path;
> @@ -494,10 +494,9 @@ fw_get_filesystem_firmware(struct device *device, struct fw_priv *fw_priv,
> fw_priv->size = 0;
>
> /* load firmware files from the mount namespace of init */
> - rc = kernel_read_file_from_path_initns(path, &buffer,
> - &size, msize,
> + rc = kernel_read_file_from_path_initns(path, &buffer, msize,
> READING_FIRMWARE);
> - if (rc) {
> + if (rc < 0) {
> if (rc != -ENOENT)
> dev_warn(device, "loading %s failed with error %d\n",
> path, rc);
> @@ -506,6 +505,7 @@ fw_get_filesystem_firmware(struct device *device, struct fw_priv *fw_priv,
> path);
> continue;
> }
> + size = rc;
Change fails to return 0. Need rc = 0; here.
> dev_dbg(device, "Loading firmware from %s\n", path);
> if (decompress) {
> dev_dbg(device, "f/w decompressing %s\n",
>
Powered by blists - more mailing lists