[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <97ad9ede-3a69-bd9e-e6c9-c2a893459565@huawei.com>
Date: Wed, 11 Sep 2019 19:41:44 +0800
From: Yunsheng Lin <linyunsheng@...wei.com>
To: Michal Hocko <mhocko@...nel.org>
CC: Greg KH <gregkh@...uxfoundation.org>, <rafael@...nel.org>,
<linux-kernel@...r.kernel.org>, <peterz@...radead.org>,
<mingo@...nel.org>, <linuxarm@...wei.com>
Subject: Re: [PATCH] driver core: ensure a device has valid node id in
device_add()
On 2019/9/11 19:03, Yunsheng Lin wrote:
> On 2019/9/11 15:34, Michal Hocko wrote:
>> On Wed 11-09-19 15:22:30, Yunsheng Lin wrote:
>> [...]
>>> It seems that there is no protection that prevent setting the node
>>> of device to an invalid node.
>>> And the kernel does have a few different check now:
>>> 1) some does " < 0" check;
>>> 2) some does "== NUMA_NO_NODE" check;
>>> 3) some does ">= MAX_NUMNODES" check;
>>> 4) some does "< 0 || >= MAX_NUMNODES || !node_online(node)" check.
>>>
>>> We need to be consistent about the checking, right?
>>
>> You can try and chase each of them and see what to do with them. I
>> suspect they are a result of random attempts to fortify the code in many
>> cases. Consistency is certainly good but spreading more checks all over
>> the place just adds more cargo cult. Each check should be reasonably
>> justified.
>
> Ok, Let me focus on making the node_to_cpumask_map() NUMA_NO_NODE aware
> by only checking "node == NUMA_NO_NODE" first.
Hi, Michal
It that ok for me to add your name to "Suggested-by" tag, since I am
going to quote some of your words on the commit log.
>
>>
>
>
> .
>
Powered by blists - more mailing lists