From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5273145909; Thu, 5 Sep 2024 08:57:01 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AE85842DBD; Thu, 5 Sep 2024 08:56:51 +0200 (CEST) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by mails.dpdk.org (Postfix) with ESMTP id 3E52442D90 for ; Thu, 5 Sep 2024 08:56:49 +0200 (CEST) Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Wzqs5594Bz1j88V; Thu, 5 Sep 2024 14:56:25 +0800 (CST) Received: from kwepemf500004.china.huawei.com (unknown [7.202.181.242]) by mail.maildlp.com (Postfix) with ESMTPS id EBD751400DC; Thu, 5 Sep 2024 14:56:46 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemf500004.china.huawei.com (7.202.181.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 5 Sep 2024 14:56:46 +0800 From: Jie Hai To: , , , Yisen Zhuang , Hongbo Zheng , "Min Hu (Connor)" CC: , , Subject: [PATCH 2/4] net/hns3: verify reset type from firmware Date: Thu, 5 Sep 2024 14:46:36 +0800 Message-ID: <20240905064638.17980-3-haijie1@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20240905064638.17980-1-haijie1@huawei.com> References: <20240905064638.17980-1-haijie1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemf500004.china.huawei.com (7.202.181.242) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Chengwen Feng Verify reset-type which get from firmware. Fixes: 1c1eb759e9d7 ("net/hns3: support RAS process in Kunpeng 930") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng --- drivers/net/hns3/hns3_intr.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c index 26fa2eb951bc..86c44f7cc3bc 100644 --- a/drivers/net/hns3/hns3_intr.c +++ b/drivers/net/hns3/hns3_intr.c @@ -2252,6 +2252,12 @@ hns3_handle_module_error_data(struct hns3_hw *hw, uint32_t *buf, sum_err_info = (struct hns3_sum_err_info *)&buf[offset++]; mod_num = sum_err_info->mod_num; reset_type = sum_err_info->reset_type; + + if (reset_type >= HNS3_MAX_RESET) { + hns3_err(hw, "invalid reset type = %u", reset_type); + return; + } + if (reset_type && reset_type != HNS3_NONE_RESET) hns3_atomic_set_bit(reset_type, &hw->reset.request); -- 2.22.0