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
| ||
|
Message-ID: <1513094591.3036.55.camel@perches.com> Date: Tue, 12 Dec 2017 08:03:11 -0800 From: Joe Perches <joe@...ches.com> To: Yaowei Bai <baiyaowei@...s.chinamobile.com>, akpm@...ux-foundation.org Cc: linux-kernel@...r.kernel.org Subject: Re: [PATCH 1/8] mm/memblock: memblock_is_map/region_memory can be boolean 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; } Maybe change to bool at your option.
Powered by blists - more mailing lists