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:   Tue, 12 Dec 2017 21:32:00 -0500
From:   Yaowei Bai <baiyaowei@...s.chinamobile.com>
To:     Joe Perches <joe@...ches.com>
Cc:     akpm@...ux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/8] mm/memblock: memblock_is_map/region_memory can be
 boolean

On Tue, Dec 12, 2017 at 08:03:11AM -0800, Joe Perches wrote:
> On Mon, 2017-12-11 at 21:55 -0500, Yaowei Bai wrote:
> > This patch makes memblock_is_map/region_memory return bool due to these
> > two functions only using either true or false as its return value.
> []
> > @@ -1690,13 +1690,13 @@ int __init_memblock memblock_search_pfn_nid(unsigned long pfn,
> >   * RETURNS:
> >   * 0 if false, non-zero if true
> >   */
> > -int __init_memblock memblock_is_region_memory(phys_addr_t base, phys_addr_t size)
> > +bool __init_memblock memblock_is_region_memory(phys_addr_t base, phys_addr_t size)
> >  {
> >  	int idx = memblock_search(&memblock.memory, base);
> >  	phys_addr_t end = base + memblock_cap_size(base, &size);
> >  
> >  	if (idx == -1)
> > -		return 0;
> > +		return false;
> >  	return (memblock.memory.regions[idx].base +
> >  		 memblock.memory.regions[idx].size) >= end;
> >  }
> 
> I'd be more inclined to use a temporary for
> memblock.memory.regions[idx] so the function was
> something like:
> 
> int __init_memblock memblock_is_region_memory(phys_addr_t base, phys_addr_t size)
> {
> 	phys_addr_t end;
> 	struct memblock_region *region;
> 	int idx = memblock_search(&memblock.memory, base);
> 
> 	if (idx == -1)
> 		return 0;
> 
> 	end = base + memblock_cap_size(base, &size);
> 	region = &memblock.memory.regions[idx];
> 
> 	return (region->base + region->size) >= end;
> }

It' better.

> 
> Maybe change to bool at your option.

Ok. You also can ack this one first. :)


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ