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: <79fb76da-f811-7030-abd6-1dd970e7ab53@redhat.com>
Date:   Fri, 16 Jul 2021 14:58:09 +0200
From:   David Hildenbrand <david@...hat.com>
To:     Miaohe Lin <linmiaohe@...wei.com>, akpm@...ux-foundation.org
Cc:     linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] mm/vmstat: simplify the array size calculation

On 15.07.21 14:29, Miaohe Lin wrote:
> We can replace the array_num * sizeof(array[0]) with sizeof(array) to
> simplify the code.

Could have mentioned taht your fixing indentation of one "return true;"

LGTM

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

> 
> Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>
> ---
>   mm/vmstat.c | 8 +++-----
>   1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/mm/vmstat.c b/mm/vmstat.c
> index 57e8e7fda7aa..76aef9510f6d 100644
> --- a/mm/vmstat.c
> +++ b/mm/vmstat.c
> @@ -1889,17 +1889,15 @@ static bool need_update(int cpu)
>   		/*
>   		 * The fast way of checking if there are any vmstat diffs.
>   		 */
> -		if (memchr_inv(pzstats->vm_stat_diff, 0, NR_VM_ZONE_STAT_ITEMS *
> -			       sizeof(pzstats->vm_stat_diff[0])))
> +		if (memchr_inv(pzstats->vm_stat_diff, 0, sizeof(pzstats->vm_stat_diff)))
>   			return true;
>   
>   		if (last_pgdat == zone->zone_pgdat)
>   			continue;
>   		last_pgdat = zone->zone_pgdat;
>   		n = per_cpu_ptr(zone->zone_pgdat->per_cpu_nodestats, cpu);
> -		if (memchr_inv(n->vm_node_stat_diff, 0, NR_VM_NODE_STAT_ITEMS *
> -			       sizeof(n->vm_node_stat_diff[0])))
> -		    return true;
> +		if (memchr_inv(n->vm_node_stat_diff, 0, sizeof(n->vm_node_stat_diff)))
> +			return true;
>   	}
>   	return false;
>   }
> 


-- 
Thanks,

David / dhildenb

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ