diff mbox series

[ovs-dev,v3,2/6] netdev-native-tnl: Fix use of uninitialized offset on SRv6 header pop.

Message ID 20240527190846.801499-3-mkp@redhat.com
State Accepted, archived
Commit 8359cc422e6541af58d306803a13225b2d01265f
Delegated to: Ilya Maximets
Headers show
Series clang: Fix Clang's static analyzer detections. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Mike Pattrick May 27, 2024, 7:08 p.m. UTC
Clang's static analyzer will complain about uninitialized value 'hlen'
because we weren't properly checking the error code from a function that
would have initialized the value.

Instead, add a check for that return code.

Fixes: 03fc1ad78521 ("userspace: Add SRv6 tunnel support.")
Signed-off-by: Mike Pattrick <mkp@redhat.com>
---
 lib/netdev-native-tnl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/netdev-native-tnl.c b/lib/netdev-native-tnl.c
index b21176037..d6f46ac4a 100644
--- a/lib/netdev-native-tnl.c
+++ b/lib/netdev-native-tnl.c
@@ -1067,7 +1067,10 @@  netdev_srv6_pop_header(struct dp_packet *packet)
     }
 
     pkt_metadata_init_tnl(md);
-    netdev_tnl_ip_extract_tnl_md(packet, tnl, &hlen);
+    if (!netdev_tnl_ip_extract_tnl_md(packet, tnl, &hlen)) {
+        goto err;
+    }
+
     dp_packet_reset_packet(packet, hlen);
 
     return packet;