lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 30 May 2022 08:54:53 +0200
From:   David Hildenbrand <david@...hat.com>
To:     Anshuman Khandual <anshuman.khandual@....com>, linux-mm@...ck.org
Cc:     Oscar Salvador <osalvador@...e.de>,
        Andrew Morton <akpm@...ux-foundation.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH V2] mm/memory_hotplug: Drop 'reason' argument from
 check_pfn_span()

On 26.05.22 04:12, Anshuman Khandual wrote:
> In check_pfn_span(), a 'reason' string is being used to recreate the caller
> function name, while printing the warning message. It is really unnecessary
> as the warning message could just be printed inside the caller depending on
> the return code. Currently there are just two callers for check_pfn_span()
> i.e  __add_pages() and __remove_pages(). Let's clean this up.
> 
> Cc: Oscar Salvador <osalvador@...e.de>
> Cc: David Hildenbrand <david@...hat.com>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: linux-mm@...ck.org
> Cc: linux-kernel@...r.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@....com>
> ---
> Changes in V2:
> 
> - Fixed typo in commit message
> - Dropped using 'ret' to capture check_pfn_span() return value in __add_pages()
> 
> Changes in V1:
> 
> https://lore.kernel.org/all/20220525033910.3781764-1-anshuman.khandual@arm.com/
> 
>  mm/memory_hotplug.c | 20 +++++++++-----------
>  1 file changed, 9 insertions(+), 11 deletions(-)
> 
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 416b38ca8def..3b24386e9276 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -220,8 +220,7 @@ static void release_memory_resource(struct resource *res)
>  	kfree(res);
>  }
>  
> -static int check_pfn_span(unsigned long pfn, unsigned long nr_pages,
> -		const char *reason)
> +static int check_pfn_span(unsigned long pfn, unsigned long nr_pages)
>  {
>  	/*
>  	 * Disallow all operations smaller than a sub-section and only
> @@ -238,12 +237,8 @@ static int check_pfn_span(unsigned long pfn, unsigned long nr_pages,
>  		min_align = PAGES_PER_SUBSECTION;
>  	else
>  		min_align = PAGES_PER_SECTION;
> -	if (!IS_ALIGNED(pfn, min_align)
> -			|| !IS_ALIGNED(nr_pages, min_align)) {
> -		WARN(1, "Misaligned __%s_pages start: %#lx end: #%lx\n",
> -				reason, pfn, pfn + nr_pages - 1);
> +	if (!IS_ALIGNED(pfn, min_align) || !IS_ALIGNED(nr_pages, min_align))

We could do

if (!IS_ALIGNED(pfn | nr_pages, min_align))


Reviewed-by: David Hildenbrand <david@...hat.com>

-- 
Thanks,

David / dhildenb

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ