Commit f7983f99 authored by Chenghai Huang's avatar Chenghai Huang Committed by 白凤
Browse files

crypto: hisilicon/sgl - Delete redundant parameter verification

maillist inclusion
category: cleanup
bugzilla: https://gitee.com/openeuler/kernel/issues/I9GMIW
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev.git/commit/?id=040279e84d4e



----------------------------------------------------------------------

The input parameter check in acc_get_sgl is redundant. The
caller has been verified once. When the check is performed for
multiple times, the performance deteriorates.

So the redundant parameter verification is deleted, and the
index verification is changed to the module entry function for
verification.

Signed-off-by: default avatarChenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarJangShui Yang <yangjiangshui@h-partners.com>
Signed-off-by: default avatarXiaoFeng Ma <maxiaofeng14@h-partners.com>
parent 4e044035
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -161,9 +161,6 @@ static struct hisi_acc_hw_sgl *acc_get_sgl(struct hisi_acc_sgl_pool *pool,
	struct mem_block *block;
	u32 block_index, offset;

	if (!pool || !hw_sgl_dma || index >= pool->count)
		return ERR_PTR(-EINVAL);

	block = pool->mem_block;
	block_index = index / pool->sgl_num_per_block;
	offset = index % pool->sgl_num_per_block;
@@ -230,7 +227,7 @@ hisi_acc_sg_buf_map_to_hw_sgl(struct device *dev,
	struct scatterlist *sg;
	int sg_n;

	if (!dev || !sgl || !pool || !hw_sgl_dma)
	if (!dev || !sgl || !pool || !hw_sgl_dma || index >= pool->count)
		return ERR_PTR(-EINVAL);

	sg_n = sg_nents(sgl);