[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190122065818.GA4087@dhcp22.suse.cz>
Date: Tue, 22 Jan 2019 07:58:18 +0100
From: Michal Hocko <mhocko@...nel.org>
To: Qian Cai <cai@....pw>
Cc: akpm@...ux-foundation.org, osalvador@...e.de,
catalin.marinas@....com, vbabka@...e.cz, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] mm/hotplug: invalid PFNs from pfn_to_online_page()
On Mon 21-01-19 16:27:47, Qian Cai wrote:
[...]
Sorry to miss this before but you want to
> +#define pfn_to_online_page(pfn) \
> +({ \
> + struct page *___page = NULL; \
unsigned long ___pfn = pfn;
> + unsigned long ___nr = pfn_to_section_nr(pfn); \
pfn_to_section_nr(___pfn);
> + \
> + if (___nr < NR_MEM_SECTIONS && online_section_nr(___nr) && \
> + pfn_valid_within(pfn)) \
pfn_valid_within(___pfn))
> + ___page = pfn_to_page(pfn); \
> + ___page; \
> })
to prevent from issues when pfn expression has side effects.
--
Michal Hocko
SUSE Labs
Powered by blists - more mailing lists