From: Eric Biggers <ebiggers@kernel.org>
To: Scott Branden <scott.branden@broadcom.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
bcm-kernel-feedback-list@broadcom.com
Subject: Re: [PATCH] exec: remove comparision of variable i_size of type loff_t against SIZE_MAX
Date: Thu, 27 Feb 2020 15:39:35 -0800 [thread overview]
Message-ID: <20200227233935.GA176371@gmail.com> (raw)
In-Reply-To: <20200227233133.10383-1-scott.branden@broadcom.com>
On Thu, Feb 27, 2020 at 03:31:33PM -0800, Scott Branden wrote:
> Remove comparision of (i_size > SIZE_MAX).
> i_size is of type loff_t and can not be great than SIZE_MAX (~(size_t)0).
>
> Signed-off-by: Scott Branden <scott.branden@broadcom.com>
> ---
> fs/exec.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/exec.c b/fs/exec.c
> index db17be51b112..16c229752f74 100644
> --- a/fs/exec.c
> +++ b/fs/exec.c
> @@ -919,7 +919,7 @@ int kernel_read_file(struct file *file, void **buf, loff_t *size,
> ret = -EINVAL;
> goto out;
> }
> - if (i_size > SIZE_MAX || (max_size > 0 && i_size > max_size)) {
> + if (max_size > 0 && i_size > max_size) {
> ret = -EFBIG;
> goto out;
> }
Nope, loff_t is 64-bit while size_t can be 32-bit. And this check is
intentional, see https://git.kernel.org/torvalds/c/691115c3513ec83e
- Eric
next prev parent reply other threads:[~2020-02-27 23:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-27 23:31 [PATCH] exec: remove comparision of variable i_size of type loff_t against SIZE_MAX Scott Branden
2020-02-27 23:39 ` Eric Biggers [this message]
2020-02-27 23:40 ` Al Viro
2020-02-27 23:49 ` Scott Branden
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200227233935.GA176371@gmail.com \
--to=ebiggers@kernel.org \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=scott.branden@broadcom.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox