Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1114078ybt; Wed, 1 Jul 2020 19:32:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9Oz/bwrgDRJ2emC3Gko4Or3eS3RaG8L4bXYFnz7DHPZGqvBOpl8D8QPsR6JRLzvamLGFy X-Received: by 2002:a05:6402:b9b:: with SMTP id cf27mr30388962edb.84.1593657172707; Wed, 01 Jul 2020 19:32:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593657172; cv=none; d=google.com; s=arc-20160816; b=sFuEJQAQ6RuobFnNQlnPfnD1nF71rBbkL/x0svySQWzO4NR4/JFrrTiPbo7n0nWbyb Po3HOwtisXTWZf02d32a5ZNPm3pzaiGBia+QYDrNkN5+xIIHR3m4vPDb+zaQMjaqLP0S b07U7pwMuNHYs0iR6iDmklZ85BWDHDRSmxbEEuMWV2L65yAdUzyQ13rpxwO2Rgl6wOz3 ntdePrVcHYfkLTofsHENDtsWN6chMfcPz8zCS0PMOEfBNz/Iqz0HYL79m+NqDj1X9cNO 6if6YfBU0tYtQT4P4k9nL72S7oc7phmBGpGwOnUG8CD54dthE2sMaKX3m/isoUeVnd30 t4iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=OuDzTklSjcePPUv8NqxZPH53DONBOtdDy2et19tIil4=; b=M16coMJ3FfmCP+VXq+2RQ/ZKukRl1iYHKL2E0I63TnQp6/oWefW9/nEGxeHsJSwI7k cfPc8X2aZhFjoupw9FTF7O/hA9iaJxB1K23gTdGu1jolo1QJr9ReIiQerDTMAoFmFBz1 1VenH8RU4iNsLIgvPJGPHl6QrEtW4XgXgosfcjY9duWuWRTq88FlqnWe1vzlV0TMtV+7 +AaHS1zqADwpTrBVJ6jEP0FWD2n9UpotWs/UOHE5zvbrKt1pi3cQW0fkY3+FWHpMX0E/ iXf4M1wxapi9nB3Qa5KiSpij/qjXZ8fvRYhfS2GezOTmwLw8PN+KWyFVUbFhLnEhA6QQ HRKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h20si5271385ejk.652.2020.07.01.19.32.30; Wed, 01 Jul 2020 19:32:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728110AbgGBCcC (ORCPT + 99 others); Wed, 1 Jul 2020 22:32:02 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:7334 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726789AbgGBCcB (ORCPT ); Wed, 1 Jul 2020 22:32:01 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id D26CEBA337C83BDB7DF1; Thu, 2 Jul 2020 10:31:58 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.487.0; Thu, 2 Jul 2020 10:31:52 +0800 From: Meng Yu To: , CC: , , , Subject: [PATCH 2/6] crypto: hisilicon/hpre - HPRE_OVERTIME_THRHLD can be written by debugfs Date: Thu, 2 Jul 2020 10:31:15 +0800 Message-ID: <1593657079-31990-3-git-send-email-yumeng18@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1593657079-31990-1-git-send-email-yumeng18@huawei.com> References: <1593657079-31990-1-git-send-email-yumeng18@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hui Tang Registers in "hpre_dfx_files" can only be cleaned to zero but HPRE_OVERTIME_THRHLD, which can be written as any number. Fixes: 64a6301ebee7("crypto: hisilicon/hpre - add debugfs for ...") Signed-off-by: Hui Tang Signed-off-by: Meng Yu Reviewed-by: Zaibo Xu Reviewed-by: Zhou Wang --- drivers/crypto/hisilicon/hpre/hpre_main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/hisilicon/hpre/hpre_main.c b/drivers/crypto/hisilicon/hpre/hpre_main.c index 624276b..be7c20e 100644 --- a/drivers/crypto/hisilicon/hpre/hpre_main.c +++ b/drivers/crypto/hisilicon/hpre/hpre_main.c @@ -553,13 +553,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; -- 2.8.1