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 91F0845D04; Thu, 14 Nov 2024 12:35:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2584540274; Thu, 14 Nov 2024 12:35:18 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) by mails.dpdk.org (Postfix) with ESMTP id 9C26440272 for ; Thu, 14 Nov 2024 12:35:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1731584116; x=1763120116; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Wb9WlB+L1LvUhsKJz7h0D5EgHKlf46AA84kqE43PnjI=; b=RpzbTaLz3xzdmxCRfnt0q1EkY1yj7XX2veJeyGFzMvlhsKfsOsaieid2 26wTalTOQrJeiD8lUGnMIOGPnUAb2oemEbu7EAKrtKXLjBlloowR7mQmk Iqm9RiVUGpJy9ghIGs02CaJEndvAmmiCxtVMClPN34KQ0RXMMFPxW+4qF F4bx1ufLjEfgBMKeCVeSxx3AObp2HBG9Qb/f8oi1p8D9ztlbWPfzs00Ty QUEzZNo1nrDGz4/IVa6NTwDi5KQqZXWiq3T+ADOGtES/WE5+uT584a3kg ghxl/andfaeiWWc7lLAPtZpxCnjJNo3KOipO0fFjdkmLjCiZRI/j9jyCU A==; X-CSE-ConnectionGUID: ih0Dn5sCRlaZthGIj68BCQ== X-CSE-MsgGUID: pjrBYYGtT4+wRkQnTg82dg== X-IronPort-AV: E=McAfee;i="6700,10204,11255"; a="31411506" X-IronPort-AV: E=Sophos;i="6.12,153,1728975600"; d="scan'208";a="31411506" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Nov 2024 03:35:15 -0800 X-CSE-ConnectionGUID: 03ljXAkZQ7SgqsQOCPkLvw== X-CSE-MsgGUID: cl4sB1iBQOCNIpnKmG1nrw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="93115226" Received: from unknown (HELO silpixa00401385.ir.intel.com) ([10.237.214.25]) by orviesa003.jf.intel.com with ESMTP; 14 Nov 2024 03:35:14 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Subject: [PATCH] net/ice: add check for null-pointer dereference Date: Thu, 14 Nov 2024 11:35:11 +0000 Message-ID: <20241114113511.3729267-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Although it should never occur that the teid (scheduler node id) value for a txq is incorrect, put in a check for null following the scheduler node lookup in ice_tm_setup_txq_node. This provides some additional safety and should eliminate a coverity issue too. Coverity issue: 448957 Fixes: 715d449a965b ("net/ice: enhance Tx scheduler hierarchy support") Signed-off-by: Bruce Richardson --- drivers/net/ice/ice_tm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ice/ice_tm.c b/drivers/net/ice/ice_tm.c index 18ac324a61..ff3a6cd77f 100644 --- a/drivers/net/ice/ice_tm.c +++ b/drivers/net/ice/ice_tm.c @@ -679,6 +679,10 @@ ice_tm_setup_txq_node(struct ice_pf *pf, struct ice_hw *hw, uint16_t qid, uint32 struct ice_sched_node *hw_node = ice_sched_find_node_by_teid(hw->port_info->root, teid); struct ice_tm_node *sw_node = find_node(pf->tm_conf.root, qid); + /* bad node teid passed */ + if (hw_node == NULL) + return -ENOENT; + /* not configured in hierarchy */ if (sw_node == NULL) return 0; -- 2.43.0