Change in openvpn[master]: Remove null check after checking for checking for did_open_tun
A message that is not in the archive (sent off-list or not yet received): gerrit.1727274369000.I9966636163c7dfa208d26f1cadbf5b81937f3a34@...2715...
Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/772?usp=email
to review the following change.
Change subject: Remove null check after checking for checking for did_open_tun
......................................................................
Remove null check after checking for checking for did_open_tun
If we indicate that the tun device has been opened the c1.tuntap struct is guaranteed to be defined. This extra null check is something that Coverity flags as we access a do a null check after already accessing fields of tuntap
Change-Id: I9966636163c7dfa208d26f1cadbf5b81937f3a34
---
M src/openvpn/init.c
1 file changed, 1 insertion(+), 4 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/72/772/1
src/openvpn/init.c +1 -4
@@ -2546,10 +2546,7 @@ {event_timeout_init (&c->c2.route_wakeup, c->options.route_delay, now);event_timeout_init (&c->c2.route_wakeup_expire, c->options.route_delay + c->options.route_delay_window, now); -if (c->c1.tuntap) - { -tun_standby_init (c->c1.tuntap); - } +tun_standby_init (c->c1.tuntap); } else {
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/772?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9966636163c7dfa208d26f1cadbf5b81937f3a34
Gerrit-Change-Number: 772
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: flichtenheld, plaisthos.
cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/772?usp=email )
Change subject: Remove null check after checking for checking for did_open_tun
......................................................................
Patch Set 1: Code-Review+2
(1 comment)
Patchset:
PS1:
Indeed, this patch makes sense - if it would be NULL, the check is too late, so in this place it does not add anything useful.
After staring at the code for quite some time I am reasonably convinced that c2.did_open_tun will only be set if do_open_tun() was called, which will either have a previously-set tuntap or will allocate a new one in do_init_tun().
do_close_tun() seems to be the only code path that could set tuntap = NULL (and it does not clear did_open_tun), but it is only called in sequences where it's either reopened right away, or where the instance ends for good.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/772?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9966636163c7dfa208d26f1cadbf5b81937f3a34
Gerrit-Change-Number: 772
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 25 Sep 2024 15:10:41 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
PATCH 1/1 Remove null check after checking for checking for did_open_tun
In reply to a message not in the archiveFrom: Arne Schwabe <[email protected]...>
If we indicate that the tun device has been opened the c1.tuntap struct is guaranteed to be defined. This extra null check is something that Coverity flags as we access a do a null check after already accessing fields of tuntap
---
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/+/772
This mail reflects revision 1 of this Change.
Signed-off-by line for the author was added as per our policy.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
src/openvpn/init.c +1 -4
@@ -2546,10 +2546,7 @@ {event_timeout_init (&c->c2.route_wakeup, c->options.route_delay, now);event_timeout_init (&c->c2.route_wakeup_expire, c->options.route_delay + c->options.route_delay_window, now); -if (c->c1.tuntap) - { -tun_standby_init (c->c1.tuntap); - } +tun_standby_init (c->c1.tuntap); } else {
[Openvpn-devel] [PATCH applied] Re: Remove null check after checking for checking for did_open_tun
I've stared long and hard on the code - nothing really to test here, as *this* pointer access will never be NULL, if the access before it already triggers the crash - and I am reasonably sure that *in this function*, if "c2.did_tun_open" is true, c1.tuntap will always be initialized, so this is safe (after do_close_tun() this is no longer guaranteed, but the code path inside do_up() does a new open right away, and the other code paths will not call do_up()).
Your patch has been applied to the master branch.
commit a8cc97f94f3e7bb52270ca2acf89804093535839
Author: Arne Schwabe Date: Wed Sep 25 17:11:04 2024 +0200
Remove null check after checking for checking for did_open_tun
Signed-off-by: Arne Schwabe <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg29447.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#2) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/772?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by cron2
Change subject: Remove null check after checking for checking for did_open_tun
......................................................................
Remove null check after checking for checking for did_open_tun
If we indicate that the tun device has been opened the c1.tuntap struct is guaranteed to be defined. This extra null check is something that Coverity flags as we access a do a null check after already accessing fields of tuntap
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg29447.html
---
M src/openvpn/init.c
1 file changed, 1 insertion(+), 4 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/72/772/2
src/openvpn/init.c +1 -4
@@ -2546,10 +2546,7 @@ {event_timeout_init (&c->c2.route_wakeup, c->options.route_delay, now);event_timeout_init (&c->c2.route_wakeup_expire, c->options.route_delay + c->options.route_delay_window, now); -if (c->c1.tuntap) - { -tun_standby_init (c->c1.tuntap); - } +tun_standby_init (c->c1.tuntap); } else {
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/772?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9966636163c7dfa208d26f1cadbf5b81937f3a34
Gerrit-Change-Number: 772
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/772?usp=email )
Change subject: Remove null check after checking for checking for did_open_tun
......................................................................
Remove null check after checking for checking for did_open_tun
If we indicate that the tun device has been opened the c1.tuntap struct is guaranteed to be defined. This extra null check is something that Coverity flags as we access a do a null check after already accessing fields of tuntap
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg29447.html
---
M src/openvpn/init.c
1 file changed, 1 insertion(+), 4 deletions(-)
src/openvpn/init.c +1 -4
@@ -2546,10 +2546,7 @@ {event_timeout_init (&c->c2.route_wakeup, c->options.route_delay, now);event_timeout_init (&c->c2.route_wakeup_expire, c->options.route_delay + c->options.route_delay_window, now); -if (c->c1.tuntap) - { -tun_standby_init (c->c1.tuntap); - } +tun_standby_init (c->c1.tuntap); } else {
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/772?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9966636163c7dfa208d26f1cadbf5b81937f3a34
Gerrit-Change-Number: 772
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged