From: Ankur Dwivedi <adwivedi@marvell.com>
To: <dev@dpdk.org>
Cc: <weiyuanx.li@intel.com>, <ferruh.yigit@amd.com>,
<jerinj@marvell.com>, <david.marchand@redhat.com>,
<thomas@monjalon.net>, <yux.jiang@intel.com>,
<dukaix.yuan@intel.com>, Ankur Dwivedi <adwivedi@marvell.com>
Subject: [PATCH v2 1/2] ethdev: fix null pointer dereference
Date: Fri, 3 Mar 2023 17:01:36 +0530 [thread overview]
Message-ID: <20230303113137.2745570-2-adwivedi@marvell.com> (raw)
In-Reply-To: <20230303113137.2745570-1-adwivedi@marvell.com>
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 <adwivedi@marvell.com>
---
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
next prev parent reply other threads:[~2023-03-03 11:32 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-23 12:30 [PATCH v1 0/2] bug fix in ethdev trace Ankur Dwivedi
2023-02-23 12:30 ` [PATCH v1 1/2] ethdev: fix null pointer dereference Ankur Dwivedi
2023-02-28 11:04 ` Ferruh Yigit
2023-02-28 11:29 ` David Marchand
2023-02-28 12:46 ` Ferruh Yigit
2023-02-28 13:17 ` Jerin Jacob
2023-02-28 13:39 ` Ferruh Yigit
2023-02-28 15:01 ` Ferruh Yigit
2023-02-28 15:40 ` [EXT] " Ankur Dwivedi
2023-02-28 16:08 ` Ferruh Yigit
2023-02-28 16:27 ` Ferruh Yigit
2023-03-02 9:58 ` Ferruh Yigit
2023-03-02 16:49 ` Ankur Dwivedi
2023-02-23 12:30 ` [PATCH v1 2/2] ethdev: pass structure pointer Ankur Dwivedi
2023-02-28 15:01 ` Ferruh Yigit
2023-03-03 11:31 ` [PATCH v2 0/2] bug fix in ethdev trace Ankur Dwivedi
2023-03-03 11:31 ` Ankur Dwivedi [this message]
2023-03-03 13:38 ` [PATCH v2 1/2] ethdev: fix null pointer dereference Ferruh Yigit
2023-03-03 11:31 ` [PATCH v2 2/2] ethdev: pass structure pointer Ankur Dwivedi
2023-03-03 13:39 ` [PATCH v2 0/2] bug fix in ethdev trace Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230303113137.2745570-2-adwivedi@marvell.com \
--to=adwivedi@marvell.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=dukaix.yuan@intel.com \
--cc=ferruh.yigit@amd.com \
--cc=jerinj@marvell.com \
--cc=thomas@monjalon.net \
--cc=weiyuanx.li@intel.com \
--cc=yux.jiang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).