Commit 6bc937b0 authored by Hui Tang's avatar Hui Tang Committed by Herbert Xu

crypto: hisilicon/hpre - HPRE_OVERTIME_THRHLD can be written by debugfs

Registers in "hpre_dfx_files" can only be cleaned to zero but
HPRE_OVERTIME_THRHLD, which can be written as any number.

Fixes: 64a6301e("crypto: hisilicon/hpre - add debugfs for ...")
Signed-off-by: default avatarHui Tang <tanghui20@huawei.com>
Signed-off-by: default avatarMeng Yu <yumeng18@huawei.com>
Reviewed-by: default avatarZaibo Xu <xuzaibo@huawei.com>
Reviewed-by: default avatarZhou Wang <wangzhou1@hisilicon.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent d7ba2c09
......@@ -548,13 +548,15 @@ static int hpre_debugfs_atomic64_get(void *data, u64 *val)
static int hpre_debugfs_atomic64_set(void *data, u64 val)
{
struct hpre_dfx *dfx_item = data;
struct hpre_dfx *hpre_dfx = dfx_item - HPRE_OVERTIME_THRHLD;
struct hpre_dfx *hpre_dfx = NULL;
if (val)
if (dfx_item->type == HPRE_OVERTIME_THRHLD) {
hpre_dfx = dfx_item - HPRE_OVERTIME_THRHLD;
atomic64_set(&hpre_dfx[HPRE_OVER_THRHLD_CNT].value, 0);
} else if (val) {
return -EINVAL;
}
if (dfx_item->type == HPRE_OVERTIME_THRHLD)
atomic64_set(&hpre_dfx[HPRE_OVER_THRHLD_CNT].value, 0);
atomic64_set(&dfx_item->value, val);
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment