* [PATCH] examples/ipsec-secgw: fix uninitialized variable access
@ 2022-11-09 9:52 Volodymyr Fialko
2022-11-10 14:14 ` Akhil Goyal
0 siblings, 1 reply; 2+ messages in thread
From: Volodymyr Fialko @ 2022-11-09 9:52 UTC (permalink / raw)
To: dev, Radu Nicolau, Akhil Goyal, Volodymyr Fialko; +Cc: jerinj, anoobj
Fix uninitialized variable access of outbound offloads flags.
Coverity issue: 381669
Fixes: 6938fc92c404 ("examples/ipsec-secgw: add lookaside event mode")
Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
---
examples/ipsec-secgw/ipsec-secgw.c | 19 +++++++++++--------
examples/ipsec-secgw/ipsec.h | 7 +++++++
examples/ipsec-secgw/ipsec_worker.c | 2 ++
3 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index 24d895451a..a64a26c992 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -105,6 +105,8 @@ struct ethaddr_info ethaddr_tbl[RTE_MAX_ETHPORTS] = {
{ 0, ETHADDR(0x00, 0x16, 0x3e, 0x49, 0x9e, 0xdd) }
};
+struct offloads tx_offloads;
+
/*
* To hold ethernet header per port, which will be applied
* to outgoing packets.
@@ -3017,16 +3019,17 @@ main(int32_t argc, char **argv)
ipv4_cksum_port_mask |= 1U << portid;
}
- for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
- if (rte_lcore_is_enabled(lcore_id) == 0)
- continue;
+ tx_offloads.ipv4_offloads = RTE_MBUF_F_TX_IPV4;
+ tx_offloads.ipv6_offloads = RTE_MBUF_F_TX_IPV6;
+ /* Update per lcore checksum offload support only if all ports support it */
+ if (ipv4_cksum_port_mask == enabled_port_mask)
+ tx_offloads.ipv4_offloads |= RTE_MBUF_F_TX_IP_CKSUM;
+ lcore_id = 0;
+ RTE_LCORE_FOREACH(lcore_id) {
/* Pre-populate pkt offloads based on capabilities */
- lcore_conf[lcore_id].outbound.ipv4_offloads = RTE_MBUF_F_TX_IPV4;
- lcore_conf[lcore_id].outbound.ipv6_offloads = RTE_MBUF_F_TX_IPV6;
- /* Update per lcore checksum offload support only if all ports support it */
- if (ipv4_cksum_port_mask == enabled_port_mask)
- lcore_conf[lcore_id].outbound.ipv4_offloads |= RTE_MBUF_F_TX_IP_CKSUM;
+ lcore_conf[lcore_id].outbound.ipv4_offloads = tx_offloads.ipv4_offloads;
+ lcore_conf[lcore_id].outbound.ipv6_offloads = tx_offloads.ipv6_offloads;
}
/*
diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h
index a21402ef5f..6bef2a7285 100644
--- a/examples/ipsec-secgw/ipsec.h
+++ b/examples/ipsec-secgw/ipsec.h
@@ -242,6 +242,13 @@ struct ipsec_ctx {
uint32_t lcore_id;
};
+struct offloads {
+ uint64_t ipv4_offloads;
+ uint64_t ipv6_offloads;
+};
+
+extern struct offloads tx_offloads;
+
struct cdev_key {
uint16_t lcore_id;
uint8_t cipher_algo;
diff --git a/examples/ipsec-secgw/ipsec_worker.c b/examples/ipsec-secgw/ipsec_worker.c
index cbb41bc192..2f02946f86 100644
--- a/examples/ipsec-secgw/ipsec_worker.c
+++ b/examples/ipsec-secgw/ipsec_worker.c
@@ -1342,6 +1342,8 @@ ipsec_wrkr_non_burst_int_port_app_mode(struct eh_event_link_info *links,
lconf.outbound.sp4_ctx = socket_ctx[socket_id].sp_ip4_out;
lconf.outbound.sp6_ctx = socket_ctx[socket_id].sp_ip6_out;
lconf.outbound.sa_ctx = socket_ctx[socket_id].sa_out;
+ lconf.outbound.ipv4_offloads = tx_offloads.ipv4_offloads;
+ lconf.outbound.ipv6_offloads = tx_offloads.ipv6_offloads;
lconf.outbound.lcore_id = lcore_id;
RTE_LOG(INFO, IPSEC,
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: [PATCH] examples/ipsec-secgw: fix uninitialized variable access
2022-11-09 9:52 [PATCH] examples/ipsec-secgw: fix uninitialized variable access Volodymyr Fialko
@ 2022-11-10 14:14 ` Akhil Goyal
0 siblings, 0 replies; 2+ messages in thread
From: Akhil Goyal @ 2022-11-10 14:14 UTC (permalink / raw)
To: Volodymyr Fialko, dev, Radu Nicolau, Volodymyr Fialko
Cc: Jerin Jacob Kollanukkaran, Anoob Joseph
> Subject: [PATCH] examples/ipsec-secgw: fix uninitialized variable access
>
> Fix uninitialized variable access of outbound offloads flags.
>
> Coverity issue: 381669
> Fixes: 6938fc92c404 ("examples/ipsec-secgw: add lookaside event mode")
>
> Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
Applied to dpdk-next-crypto
Thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-10 14:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-09 9:52 [PATCH] examples/ipsec-secgw: fix uninitialized variable access Volodymyr Fialko
2022-11-10 14:14 ` Akhil Goyal
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).