diff --git a/drivers/crypto/hisilicon/hpre/hpre_crypto.c b/drivers/crypto/hisilicon/hpre/hpre_crypto.c index 7fbdc67dce9131ad1b6c56a7f0086601f165b50c..b8651bcd001d3b46fe1fcc8983f2b1747e9cafe8 100644 --- a/drivers/crypto/hisilicon/hpre/hpre_crypto.c +++ b/drivers/crypto/hisilicon/hpre/hpre_crypto.c @@ -495,6 +495,10 @@ static int hpre_dh_set_params(struct hpre_ctx *ctx, struct dh *params) struct device *dev = &GET_DEV(ctx); unsigned int sz; +#define _HPRE_DH_MAX_P_SZ 512 + if (params->p_size > _HPRE_DH_MAX_P_SZ) + return -EINVAL; + if (hpre_dh_check_params_length(params->p_size << HPRE_BITS_2_BYTES_SHIFT)) return -EINVAL; diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index 9a22c0646a75b436f97dc9111618ee92199a7f5d..1866809676239fc0869cd80fa31b63e3c4da1bf1 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -1019,6 +1019,7 @@ static const struct file_operations qm_regs_fops = { .owner = THIS_MODULE, .open = qm_regs_open, .read = seq_read, + .release = single_release, }; static int qm_create_debugfs_file(struct hisi_qm *qm, enum qm_debug_file index) @@ -1674,13 +1675,14 @@ static int hisi_qm_uacce_mmap(struct uacce_queue *q, switch (qfr->type) { case UACCE_QFRT_MMIO: - - /* Try to mmap corresponding pages size region */ - if (qm->ver == QM_HW_V2) - WARN_ON(sz > PAGE_SIZE * (QM_DOORBELL_PAGE_NR + - QM_V2_DOORBELL_OFFSET / PAGE_SIZE)); - else - WARN_ON(sz > PAGE_SIZE * QM_DOORBELL_PAGE_NR); + if (qm->ver == QM_HW_V2) { + if (WARN_ON(sz > PAGE_SIZE * (QM_DOORBELL_PAGE_NR + + QM_V2_DOORBELL_OFFSET / PAGE_SIZE))) + return -EINVAL; + } else { + if (WARN_ON(sz > PAGE_SIZE * QM_DOORBELL_PAGE_NR)) + return -EINVAL; + } vma->vm_flags |= VM_IO;