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]
Message-Id: <20141209145038.6253a2b99379bfb1255fa95e@linux-foundation.org>
Date:	Tue, 9 Dec 2014 14:50:38 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Xishi Qiu <qiuxishi@...wei.com>
Cc:	Ingo Molnar <mingo@...nel.org>, <dave@...1.net>,
	Rik van Riel <riel@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	<linux-tip-commits@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Linux MM <linux-mm@...ck.org>
Subject: Re: [PATCH V2] x86/mm: Fix zone ranges boot printout

On Tue, 9 Dec 2014 11:27:20 +0800 Xishi Qiu <qiuxishi@...wei.com> wrote:

> Changelog:
> V2:
> 	-fix building warnings of min(...).
>
> ...
>
> --- a/arch/x86/mm/init.c
> +++ b/arch/x86/mm/init.c
> @@ -674,10 +674,12 @@ void __init zone_sizes_init(void)
>  	memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
>  
>  #ifdef CONFIG_ZONE_DMA
> -	max_zone_pfns[ZONE_DMA]		= MAX_DMA_PFN;
> +	max_zone_pfns[ZONE_DMA]		= min_t(unsigned long,
> +						max_low_pfn, MAX_DMA_PFN);

MAX_DMA_PFN has type int.

>  #endif
>  #ifdef CONFIG_ZONE_DMA32
> -	max_zone_pfns[ZONE_DMA32]	= MAX_DMA32_PFN;
> +	max_zone_pfns[ZONE_DMA32]	= min_t(unsigned long,
> +						max_low_pfn, MAX_DMA32_PFN);

MAX_DMA32_PFN has type UL (I think?) so there's no need for min_t here.

>  #endif
>  	max_zone_pfns[ZONE_NORMAL]	= max_low_pfn;
>  #ifdef CONFIG_HIGHMEM


Let's try to get the types correct, rather than hacking around fixing
up fallout from earlier incorrect type choices?

What is the type of a pfn?  Unsigned long, generally, when we bother
thinking about it.

So how about we make MAX_DMA_PFN have type UL?  I assume that fixes the
warning?

If we do this, we should also be able to undo the min_t hackery in
arch/x86/kernel/e820.c:memblock_find_dma_reserve().

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ