[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190725064559.GA14323@avx2>
Date: Thu, 25 Jul 2019 09:45:59 +0300
From: Alexey Dobriyan <adobriyan@...il.com>
To: Toshiki Fukasawa <t-fukasawa@...jp.nec.com>
Cc: "linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"mhocko@...nel.org" <mhocko@...nel.org>,
"dan.j.williams@...el.com" <dan.j.williams@...el.com>,
"hch@....de" <hch@....de>,
Naoya Horiguchi <n-horiguchi@...jp.nec.com>,
Junichi Nomura <j-nomura@...jp.nec.com>
Subject: Re: [PATCH 1/2] /proc/kpageflags: prevent an integer overflow in
stable_page_flags()
On Thu, Jul 25, 2019 at 02:31:16AM +0000, Toshiki Fukasawa wrote:
> stable_page_flags() returns kpageflags info in u64, but it uses
> "1 << KPF_*" internally which is considered as int. This type mismatch
> causes no visible problem now, but it will if you set bit 32 or more as
> done in a subsequent patch. So use BIT_ULL in order to avoid future
> overflow issues.
> - return 1 << KPF_NOPAGE;
> + return BIT_ULL(KPF_NOPAGE);
This won't happen until bit 31 is used and all the flags are within int
currently and stable(!), so the problem doesn't exist for them.
Overflow implies some page flags are 64-bit only, which hopefully won't
happen.
Powered by blists - more mailing lists