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: <c18ee8d6786b0aa4d6c868ac2c12e684f348daff.camel@perches.com>
Date:   Tue, 30 Mar 2021 00:53:27 -0700
From:   Joe Perches <joe@...ches.com>
To:     Kai Ye <yekai13@...wei.com>, herbert@...dor.apana.org.au
Cc:     linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
        wangzhou1@...ilicon.com
Subject: Re: [PATCH v2 1/5] crypto: hisilicon/sgl - fixup coding style

On Tue, 2021-03-30 at 15:39 +0800, Kai Ye wrote:
> use a macro replace of a magic number.

Given the use of 32 in the same test, this
seems more obfuscating that useful to me.

> diff --git a/drivers/crypto/hisilicon/sgl.c b/drivers/crypto/hisilicon/sgl.c
[]
> @@ -9,6 +9,7 @@
>  #define HISI_ACC_SGL_NR_MAX		256
>  #define HISI_ACC_SGL_ALIGN_SIZE		64
>  #define HISI_ACC_MEM_BLOCK_NR		5
> +#define HISI_ACC_BLOCK_SIZE_MAX_SHIFT	31
>  
> 
>  struct acc_hw_sge {
>  	dma_addr_t buf;
> @@ -67,7 +68,8 @@ struct hisi_acc_sgl_pool *hisi_acc_create_sgl_pool(struct device *dev,
>  	sgl_size = sizeof(struct acc_hw_sge) * sge_nr +
>  		   sizeof(struct hisi_acc_hw_sgl);
>  	block_size = 1 << (PAGE_SHIFT + MAX_ORDER <= 32 ?
> -			   PAGE_SHIFT + MAX_ORDER - 1 : 31);
> +			   PAGE_SHIFT + MAX_ORDER - 1 :
> +			   HISI_ACC_BLOCK_SIZE_MAX_SHIFT);
>  	sgl_num_per_block = block_size / sgl_size;
>  	block_num = count / sgl_num_per_block;
>  	remain_sgl = count % sgl_num_per_block;


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ