lkml.org 
[lkml]   [2019]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v4] memory_hotplug: Add a bounds check to __add_pages
From
Date
On 26.09.19 09:40, Oscar Salvador wrote:
> On Thu, Sep 26, 2019 at 11:34:05AM +1000, Alastair D'Silva wrote:
>> From: Alastair D'Silva <alastair@d-silva.org>
>> @@ -291,6 +307,10 @@ int __ref __add_pages(int nid, unsigned long pfn, unsigned long nr_pages,
>> unsigned long nr, start_sec, end_sec;
>> struct vmem_altmap *altmap = restrictions->altmap;
>>
>> + err = check_hotplug_memory_addressable(pfn, nr_pages);
>> + if (err)
>> + return err;
>> +
>
> I am probably off here because 1) I am jumping blind in a middle of a discussion and
> 2) I got back from holydays yesterday, so bear with me.
>
> Would not be better to just place the check in add_memory_resource instead?

At least devmem/memremap needs special handling.

> Take into account that we create the memory mapping for this range in
> arch_add_memory, so it looks weird to me to create the mapping if we are going to
> fail right after because the range is simply off.
>
> But as I said, I might be missing some previous discussion.
>


--

Thanks,

David / dhildenb

\
 
 \ /
  Last update: 2019-09-26 09:43    [W:0.096 / U:1.448 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site