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 90C5D41DC7; Fri, 3 Mar 2023 12:32:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7D97640EE3; Fri, 3 Mar 2023 12:32:00 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id BF5D6400D6 for ; Fri, 3 Mar 2023 12:31:58 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 323A4E6c013534; Fri, 3 Mar 2023 03:31:56 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=DOIMoaYHdC6OB2KcjFmYYxO45ZZWLi9XolD8EfXfz6E=; b=TnC6aEOm3PLxSJw5oCQnTbfGlSDa+9+5SUNINZ6X0EA16KjpS7A2a3XwviAipiE+z+xx M2tNTkMvrg0XAYiMxRtZ6gcXf5lHCyydNmR2WsRZWMNWwnj/RSXag4Cf7hBG+UZsCe6F H4QoJZYcANeGpOXEmbLTFKnC7WPvPPj5p1MWgjENx0NSNPLyOoK451nHqQwZCLgDLOiy CiPuCh7Em1wGCXVBAkUNbGxJYhOI7OjglhvGWoKpTeHww1r9OnyldoW/gn8mOxChk+e7 AE2uGO+9ldc/Hq3GmPT9IqkZCRQqyRoGCouz/sEEC/xhbwrLIK+oMeuzx8H3DHeGq1/w bA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3p2vg53uct-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 03 Mar 2023 03:31:56 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 3 Mar 2023 03:31:54 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.42 via Frontend Transport; Fri, 3 Mar 2023 03:31:54 -0800 Received: from localhost.localdomain (unknown [10.28.36.185]) by maili.marvell.com (Postfix) with ESMTP id 4043E3F7048; Fri, 3 Mar 2023 03:31:52 -0800 (PST) From: Ankur Dwivedi To: CC: , , , , , , , Ankur Dwivedi Subject: [PATCH v2 1/2] ethdev: fix null pointer dereference Date: Fri, 3 Mar 2023 17:01:36 +0530 Message-ID: <20230303113137.2745570-2-adwivedi@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230303113137.2745570-1-adwivedi@marvell.com> References: <20230223123029.2117781-1-adwivedi@marvell.com> <20230303113137.2745570-1-adwivedi@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: 8Pyq_4hxwndbXZz-1qnZibZeWWVYLmuj X-Proofpoint-GUID: 8Pyq_4hxwndbXZz-1qnZibZeWWVYLmuj X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-03_01,2023-03-03_01,2023-02-09_01 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 The speed_fec_capa pointer can be null. So dereferencing the pointer is removed and only the pointer is captured in trace function. Fixed few more trace functions in which null pointer can be dereferenced. As a result of this fix the address sanitizer error observed with rte_eth_trace_find_next_of() is also resolved. Coverity issue: 383238 Bugzilla ID: 1162 Fixes: 6679cf21d608 ("ethdev: add trace points") Fixes: ed04fd4072e9 ("ethdev: add trace points for flow") Signed-off-by: Ankur Dwivedi --- lib/ethdev/ethdev_trace.h | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/lib/ethdev/ethdev_trace.h b/lib/ethdev/ethdev_trace.h index 6c2a68216f..bfcb024ac1 100644 --- a/lib/ethdev/ethdev_trace.h +++ b/lib/ethdev/ethdev_trace.h @@ -123,8 +123,7 @@ RTE_TRACE_POINT( RTE_TRACE_POINT_ARGS(uint16_t port_id, const struct rte_eth_dev_owner *owner, int ret), rte_trace_point_emit_u16(port_id); - rte_trace_point_emit_u64(owner->id); - rte_trace_point_emit_string(owner->name); + rte_trace_point_emit_ptr(owner); rte_trace_point_emit_int(ret); ) @@ -351,9 +350,7 @@ RTE_TRACE_POINT( rte_eth_trace_find_next_of, RTE_TRACE_POINT_ARGS(uint16_t port_id, const struct rte_device *parent), rte_trace_point_emit_u16(port_id); - rte_trace_point_emit_string(parent->name); - rte_trace_point_emit_string(parent->bus_info); - rte_trace_point_emit_int(parent->numa_node); + rte_trace_point_emit_ptr(parent); ) RTE_TRACE_POINT( @@ -831,8 +828,7 @@ RTE_TRACE_POINT( const struct rte_eth_fec_capa *speed_fec_capa, unsigned int num, int ret), rte_trace_point_emit_u16(port_id); - rte_trace_point_emit_u32(speed_fec_capa->speed); - rte_trace_point_emit_u32(speed_fec_capa->capa); + rte_trace_point_emit_ptr(speed_fec_capa); rte_trace_point_emit_u32(num); rte_trace_point_emit_int(ret); ) @@ -1135,10 +1131,8 @@ RTE_TRACE_POINT( RTE_TRACE_POINT( rte_eth_trace_read_clock, RTE_TRACE_POINT_ARGS(uint16_t port_id, const uint64_t *clk, int ret), - uint64_t clk_v = *clk; - rte_trace_point_emit_u16(port_id); - rte_trace_point_emit_u64(clk_v); + rte_trace_point_emit_ptr(clk); rte_trace_point_emit_int(ret); ) @@ -1378,8 +1372,7 @@ RTE_TRACE_POINT( const struct rte_flow_item *pattern, const struct rte_flow_action *actions, int ret), rte_trace_point_emit_u16(port_id); - rte_trace_point_emit_u32(attr->group); - rte_trace_point_emit_u32(attr->priority); + rte_trace_point_emit_ptr(attr); rte_trace_point_emit_ptr(pattern); rte_trace_point_emit_ptr(actions); rte_trace_point_emit_int(ret); @@ -1472,10 +1465,7 @@ RTE_TRACE_POINT( const struct rte_flow_item_flex_conf *conf, const struct rte_flow_item_flex_handle *handle), rte_trace_point_emit_u16(port_id); - rte_trace_point_emit_int(conf->tunnel); - rte_trace_point_emit_int(conf->nb_samples); - rte_trace_point_emit_int(conf->nb_inputs); - rte_trace_point_emit_int(conf->nb_outputs); + rte_trace_point_emit_ptr(conf); rte_trace_point_emit_ptr(handle); ) @@ -2216,8 +2206,7 @@ RTE_TRACE_POINT_FP( const struct rte_flow_action *actions, const struct rte_flow *flow), rte_trace_point_emit_u16(port_id); - rte_trace_point_emit_u32(attr->group); - rte_trace_point_emit_u32(attr->priority); + rte_trace_point_emit_ptr(attr); rte_trace_point_emit_ptr(pattern); rte_trace_point_emit_ptr(actions); rte_trace_point_emit_ptr(flow); @@ -2240,8 +2229,7 @@ RTE_TRACE_POINT_FP( int ret), rte_trace_point_emit_u16(port_id); rte_trace_point_emit_ptr(flow); - rte_trace_point_emit_int(action->type); - rte_trace_point_emit_ptr(action->conf); + rte_trace_point_emit_ptr(action); rte_trace_point_emit_ptr(data); rte_trace_point_emit_int(ret); ) -- 2.25.1