From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Fri, 30 Mar 2018 13:57:27 -0700 From: Andrew Morton To: Wei Yang Cc: mhocko@suse.com, yinghai@kernel.org, linux-mm@kvack.org, hejianet@gmail.com, "3 . 12+" Subject: Re: [PATCH] mm/memblock: fix potential issue in memblock_search_pfn_nid() Message-Id: <20180330135727.67251c7ea8c2db28b404e0e1@linux-foundation.org> In-Reply-To: <20180330033055.22340-1-richard.weiyang@gmail.com> References: <20180330033055.22340-1-richard.weiyang@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: On Fri, 30 Mar 2018 11:30:55 +0800 Wei Yang wrote: > memblock_search_pfn_nid() returns the nid and the [start|end]_pfn of the > memory region where pfn sits in. While the calculation of start_pfn has > potential issue when the regions base is not page aligned. > > For example, we assume PAGE_SHIFT is 12 and base is 0x1234. Current > implementation would return 1 while this is not correct. Why is this not correct? The caller might want the pfn of the page which covers the base? > This patch fixes this by using PFN_UP(). > > The original commit is commit e76b63f80d93 ("memblock, numa: binary search > node id") and merged in v3.12. > > Signed-off-by: Wei Yang > Cc: 3.12+ Please fully describe the runtime effects of a bug when fixing that bug. This description doesn't give enough justification for merging the patch into mainline, let alone -stable.