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: <d96db1d04062a2a88eb51f319c2aef0a440755c3.camel@perches.com>
Date:   Tue, 17 Aug 2021 17:39:18 -0700
From:   Joe Perches <joe@...ches.com>
To:     Jason Wang <wangborong@...rlc.com>, kuba@...nel.org
Cc:     davem@...emloft.net, tariqt@...dia.com, netdev@...r.kernel.org,
        linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net/mlx4: Use ARRAY_SIZE to get an array's size

On Tue, 2021-08-17 at 20:11 +0800, Jason Wang wrote:
> The ARRAY_SIZE macro is defined to get an array's size which is
> more compact and more formal in linux source. Thus, we can replace
> the long sizeof(arr)/sizeof(arr[0]) with the compact ARRAY_SIZE.
[]
> diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c
[]
> @@ -739,7 +739,7 @@ static void mlx4_cleanup_qp_zones(struct mlx4_dev *dev)
>  		int i;
>  
> 
>  		for (i = 0;
> -		     i < sizeof(qp_table->zones_uids)/sizeof(qp_table->zones_uids[0]);
> +		     i < ARRAY_SIZE(qp_table->zones_uids);
>  		     i++) {

trivia:  could now be a single line

		for (i = 0; i < ARRAY_SIZE(qp_table->zones_uids); i++) {


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ