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] [day] [month] [year] [list]
Message-ID: <YDKvLurzMw1NO4JN@osiris>
Date:   Sun, 21 Feb 2021 20:06:22 +0100
From:   Heiko Carstens <hca@...ux.ibm.com>
To:     Yang Li <yang.lee@...ux.alibaba.com>
Cc:     gor@...ux.ibm.com, borntraeger@...ibm.com,
        linux-s390@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] KVM: s390: use ARRAY_SIZE instead of division operation

On Sat, Feb 20, 2021 at 04:22:37PM +0800, Yang Li wrote:
> This eliminates the following coccicheck warning:
> ./arch/s390/tools/gen_facilities.c:154:37-38: WARNING: Use ARRAY_SIZE
> ./arch/s390/tools/gen_opcode_table.c:141:39-40: WARNING: Use ARRAY_SIZE
> 
> Reported-by: Abaci Robot <abaci@...ux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@...ux.alibaba.com>
> ---
>  arch/s390/tools/gen_facilities.c   | 2 +-
>  arch/s390/tools/gen_opcode_table.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/s390/tools/gen_facilities.c b/arch/s390/tools/gen_facilities.c
> index 61ce5b5..5366817 100644
> --- a/arch/s390/tools/gen_facilities.c
> +++ b/arch/s390/tools/gen_facilities.c
> @@ -151,7 +151,7 @@ static void print_facility_lists(void)
>  {
>  	unsigned int i;
>  
> -	for (i = 0; i < sizeof(facility_defs) / sizeof(facility_defs[0]); i++)
> +	for (i = 0; i < ARRAY_SIZE(facility_defs); i++)
>  		print_facility_list(&facility_defs[i]);
>  }
>  
> diff --git a/arch/s390/tools/gen_opcode_table.c b/arch/s390/tools/gen_opcode_table.c
> index a1bc02b..468b70c 100644
> --- a/arch/s390/tools/gen_opcode_table.c
> +++ b/arch/s390/tools/gen_opcode_table.c
> @@ -138,7 +138,7 @@ static struct insn_type *insn_format_to_type(char *format)
>  	strcpy(tmp, format);
>  	base_format = tmp;
>  	base_format = strsep(&base_format, "_");
> -	for (i = 0; i < sizeof(insn_type_table) / sizeof(insn_type_table[0]); i++) {
> +	for (i = 0; i < ARRAY_SIZE(insn_type_table); i++) {

There is a reason why this doesn't use ARRAY_SIZE()...
Please stop sending trivial patches without even looking at the code.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ