linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tobias Stoeckmann <tobias@stoeckmann.org>
To: Lucas De Marchi <lucas.de.marchi@gmail.com>
Cc: linux-modules <linux-modules@vger.kernel.org>
Subject: Re: [PATCH] Verify memory sizes on 32 bit systems.
Date: Fri, 3 Aug 2018 23:51:35 +0200	[thread overview]
Message-ID: <20180803215135.GA55860@pepper.home.stoeckmann.org> (raw)
In-Reply-To: <CAKi4VAKK5MSODC-VbFWG2d0p-eUXqrPbpNiomJb6+BEhfWjBVQ@mail.gmail.com>

On Fri, Aug 03, 2018 at 02:33:51PM -0700, Lucas De Marchi wrote:
> so you are casting the *sign* away, ok. But casting only st.st_size
> should suffice.

I've just tried with some examples and I couldn't trigger the
warning which I have seen in other situations like this, i.e.
"always false due to limited range of data type".

If I cast the off_t to size_t, the compiler knows that it is not
possible that it could ever be larger than SIZE_MAX, optimizing
the block away. So I took uintmax_t.

But as long as there's no annoying warning, I am fine with just
casting st_size.


Tobias

      reply	other threads:[~2018-08-03 21:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-30 19:01 [PATCH] Verify memory sizes on 32 bit systems Tobias Stoeckmann
2018-08-03 21:07 ` Lucas De Marchi
2018-08-03 21:10   ` Tobias Stoeckmann
2018-08-03 21:33     ` Lucas De Marchi
2018-08-03 21:51       ` Tobias Stoeckmann [this message]

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=20180803215135.GA55860@pepper.home.stoeckmann.org \
    --to=tobias@stoeckmann.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=lucas.de.marchi@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).