[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6fff45a4-aed1-ada1-43cd-cea270c12ce1@csgroup.eu>
Date: Thu, 27 Jan 2022 11:33:57 +0000
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Mike Rapoport <rppt@...nel.org>
CC: Luis Chamberlain <mcgrof@...nel.org>, Jessica Yu <jeyu@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
"kgdb-bugreport@...ts.sourceforge.net"
<kgdb-bugreport@...ts.sourceforge.net>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>
Subject: Re: [PATCH 1/7] modules: Refactor within_module_core() and
within_module_init()
Le 26/01/2022 à 22:36, Mike Rapoport a écrit :
> On Mon, Jan 24, 2022 at 09:22:15AM +0000, Christophe Leroy wrote:
>> within_module_core() and within_module_init() are doing the exact same
>> test, one on core_layout, the second on init_layout.
>>
>> In preparation of increasing the complexity of that verification,
>> refactor it into a single function called within_module_layout().
>>
>> Signed-off-by: Christophe Leroy <christophe.leroy@...roup.eu>
>> ---
>> include/linux/module.h | 17 +++++++++++++----
>> 1 file changed, 13 insertions(+), 4 deletions(-)
>>
>> diff --git a/include/linux/module.h b/include/linux/module.h
>> index c9f1200b2312..33b4db8f5ca5 100644
>> --- a/include/linux/module.h
>> +++ b/include/linux/module.h
>> @@ -565,18 +565,27 @@ bool __is_module_percpu_address(unsigned long addr, unsigned long *can_addr);
>> bool is_module_percpu_address(unsigned long addr);
>> bool is_module_text_address(unsigned long addr);
>>
>> +static inline bool within_range(unsigned long addr, void *base, unsigned int size)
>> +{
>> + return addr >= (unsigned long)base && addr < (unsigned long)base + size;
>> +}
>
> There's also 'within' at least in arch/x86/mm/pat/set_memory.c and surely
> tons of open-coded "address within" code.
>
> Should it live in, say, include/linux/range.h?
>
include/linux/range.h has functions that work with struct ranges.
It might be an alternative, to be investigated a bit more.
At the time being, this change finally brings little added value so
I drop the two first patches from the series.
Thanks
Christophe
Powered by blists - more mailing lists