[Openvpn-devel,v3] multi: Remove useless checks

Message ID 20260513091710.28378-1-gert@greenie.muc.de
State New
Headers show
Series [Openvpn-devel,v3] multi: Remove useless checks | expand

Commit Message

Gert Doering May 13, 2026, 9:17 a.m. UTC
From: Frank Lichtenheld <frank@lichtenheld.com>

If mi is NULL, the previous code lines already
segfaulted.

Identified by cppcheck.

Change-Id: If58bb807842b7b95aeffe6849e7a7344e4925762
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1667
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1667
This mail reflects revision 3 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <gert@greenie.muc.de>

Comments

Gert Doering May 13, 2026, 11:10 a.m. UTC | #1
Valid finding... - as this is conditional code, and we would test this
stuff on master, no need to apply to 2.7.

Not tested, but stared-hard-at-code :-)

Your patch has been applied to the master branch.

commit 9922d2c3f397944625b99afe984563cb2d9a0456
Author: Frank Lichtenheld
Date:   Wed May 13 11:17:05 2026 +0200

     multi: Remove useless checks

     Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1667
     Message-Id: <20260513091710.28378-1-gert@greenie.muc.de>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36899.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c
index 06e3758..a957fdf 100644
--- a/src/openvpn/multi.c
+++ b/src/openvpn/multi.c
@@ -3054,8 +3054,8 @@ 
 
 #ifdef MULTI_DEBUG_EVENT_LOOP
         printf("POST %s[%d] to=%d lo=%d/%d w=%" PRIi64 "/%ld\n", id(mi), (int)(mi == m->pending),
-               mi ? mi->context.c2.to_tun.len : -1, mi ? mi->context.c2.to_link.len : -1,
-               (mi && mi->context.c2.fragment) ? mi->context.c2.fragment->outgoing.len : -1,
+               mi->context.c2.to_tun.len, mi->context.c2.to_link.len,
+               mi->context.c2.fragment ? mi->context.c2.fragment->outgoing.len : -1,
                (int64_t)mi->context.c2.timeval.tv_sec, (long)mi->context.c2.timeval.tv_usec);
 #endif
     }