[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251223121104.6614c1e3@pumpkin>
Date: Tue, 23 Dec 2025 12:11:04 +0000
From: David Laight <david.laight.linux@...il.com>
To: Li Wang <liwang@...hat.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, David Hildenbrand <david@...nel.org>, Mark Brown
<broonie@...nel.org>, Shuah Khan <shuah@...nel.org>, Waiman Long
<longman@...hat.com>
Subject: Re: [PATCH v3 1/3] selftests/mm/write_to_hugetlbfs: parse -s as
size_t
On Tue, 23 Dec 2025 17:29:38 +0800
Li Wang <liwang@...hat.com> wrote:
> David Laight <david.laight.linux@...il.com> wrote:
>
> > What was wrong with atoi() ?
>
> As the patch summary described, write_to_hugetlbfs previously parsed -s via
> atoi() into an int, which can overflow and print negative sizes. This
> problem was
> found on our kernel-64k platform and
>
> #./charge_reserved_hugetlb.sh -cgroup-v2
> # -----------------------------------------
> ...
> # nr hugepages = 10
> # writing cgroup limit: 5368709120
> # writing reseravation limit: 5368709120
> ...
> # Writing to this path: /mnt/huge/test
> # Writing this size: -1610612736 <--------
So the problem was that atoi() doesn't let you specify valid values
over 2GB.
That isn't how I read the patch summary.
It read as though you were worried about detecting invalid input.
David
Powered by blists - more mailing lists