lkml.org 
[lkml]   [2019]   [Jan]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2019-01-22 07:58    [W:0.040 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site