public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: CaT <cat@zip.com.au>
To: Hugh Dickins <hugh@veritas.com>
Cc: Xavier Bestel <xavier.bestel@free.fr>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@transmeta.com>,
	Marcelo Tosatti <marcelo@conectiva.com.br>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: PATCH: allow percentile size of tmpfs (2.5.66 / 2.4.20-pre2)
Date: Wed, 2 Apr 2003 00:23:18 +1000	[thread overview]
Message-ID: <20030401142317.GC459@zip.com.au> (raw)
In-Reply-To: <Pine.LNX.4.44.0304011207500.9723-100000@localhost.localdomain>

On Tue, Apr 01, 2003 at 12:11:46PM +0100, Hugh Dickins wrote:
> On 1 Apr 2003, Xavier Bestel wrote:
> >                         size = memparse(value,&rest);
> > +                       if (*rest == '%') {
> > +                               struct sysinfo si;
> > +                               si_meminfo(&si);
> > +                               size = (si.totalram << PAGE_CACHE_SHIFT) / 100 * size;
> > 
> > (si.totalram << PAGE_CACHE_SHIFT) * size / 100;
> > would have been better precision-wise.
> 
> Hardly, it'll overflow in even more cases
> than CaT's (si.totalram << PAGE_CACHE_SHIFT).

Yes. I had it initially as Xavier suggested but after thinking about it
a bit I felt that making the value smaller and -then- bigger was safer.

> I'll take a look at this later, not right now.

It is still an unsigned long long int so (AFAIK) it wont overflow till
it hits 18,446,744,073,709,551,615. Now... if you have that much ram...
wow! :)

Basically it'll only overflow for astoundingly stupid values of size and
when it comes down to it, I think you could still make it overflow by
setting a REALLY large static value for size anyways (liek greater then
the above). Same issue as far as I can see.

-- 
"Other countries of course, bear the same risk. But there's no doubt his
hatred is mainly directed at us. After all this is the guy who tried to
kill my dad."
        - George W. Bush Jr, Leader of the United States Regime
          September 26, 2002 (from a political fundraiser in Houston, Texas)

  reply	other threads:[~2003-04-01 14:13 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-01  8:10 PATCH: allow percentile size of tmpfs (2.5.66 / 2.4.20-pre2) CaT
2003-04-01 10:59 ` Xavier Bestel
2003-04-01 11:11   ` Hugh Dickins
2003-04-01 14:23     ` CaT [this message]
2003-04-01 14:43       ` Hugh Dickins
2003-04-01 14:54         ` CaT
     [not found] <fa.eagpkml.m3elbd@ifi.uio.no>
2003-04-01 13:38 ` Ed Tomlinson
2003-04-01 14:17   ` Hugh Dickins
2003-04-01 14:18   ` CaT
2003-04-01 16:27   ` Christoph Rohland
2003-04-01 16:45     ` Hugh Dickins
2003-04-02  7:20       ` Christoph Rohland
2003-04-02  8:12         ` William Lee Irwin III
2003-04-02 14:44         ` CaT
2003-04-02 17:33           ` Christoph Rohland
2003-04-02 20:44             ` Jörn Engel
2003-04-02 21:04               ` Hugh Dickins
2003-04-03  7:44                 ` Jörn Engel
2003-04-07  8:32                 ` Christoph Rohland
2003-04-07 11:55                   ` Hugh Dickins
2003-04-07 11:59                     ` Christoph Rohland
2003-04-04 11:31               ` Henning P. Schmiedehausen
2003-04-03  5:35             ` CaT
2003-04-03 10:42               ` CaT
2003-04-02 10:04     ` Jörn Engel
2003-04-03  2:54     ` Robert White
2003-04-03  8:35       ` Hugh Dickins
2003-04-03 20:55         ` Robert White
  -- strict thread matches above, loose matches on Subject: below --
2003-04-01 14:22 Mikael Starvik
2003-04-01 16:24 ` Christoph Rohland
2003-04-01 18:26   ` Daniel Egger
2003-04-01 19:25     ` Hugh Dickins
2003-04-01 19:57       ` Daniel Egger
2003-04-02  7:13     ` Christoph Rohland
2003-04-02  7:55       ` Hua Zhong
2003-04-02 10:26         ` Hugh Dickins
2003-04-03  2:49         ` Robert White
2003-04-03  2:54           ` Hua Zhong

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=20030401142317.GC459@zip.com.au \
    --to=cat@zip.com.au \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    --cc=torvalds@transmeta.com \
    --cc=xavier.bestel@free.fr \
    /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