From: "its_Giaan (Code Review)" Date: Fri, 24 Jan 2025 12:43:06 +0000 References: Reply-To: gianmarco@...2726..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <11aa8b9c09fc615599857e7019fed07294bf914a-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="dwe3qv+v7k4="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[master]: Fix PASS_BY_VALUE issue in options_postprocess_mutate_le() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel --dwe3qv+v7k4= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld, plaisthos. Hello plaisthos, flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/875?usp=3Demail to review the following change. Change subject: Fix PASS_BY_VALUE issue in options_postprocess_mutate_le() ...................................................................... Fix PASS_BY_VALUE issue in options_postprocess_mutate_le() Fix issue reported by Coverity: CID 1641424: Performance inefficiencies (PASS_BY_VALUE) Passing parameter ce of type "struct connection_entry" (size 208 bytes) by value, which exceeds the low threshold of 128 bytes. Commit 8466c2ca unintentionally introduced a performance penalty due to passing struct connection_entry 'ce' by value to options_postprocess_mutate_le(). fix this by passing 'ce' by address. Change-Id: I0542df021ae0ba9c982335fed7bbd10ed326dd0f Signed-off-by: Gianmarco De Gregori --- M src/openvpn/options.c 1 file changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/75/875/1 diff --git a/src/openvpn/options.c b/src/openvpn/options.c index c938999..bd5c056 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -3323,12 +3323,12 @@ } static void -options_postprocess_mutate_le(struct connection_entry ce, struct local_ent= ry *le) +options_postprocess_mutate_le(struct connection_entry *ce, struct local_en= try *le) { /* use the global port if none is specified */ if (!le->port) { - le->port =3D ce.local_port; + le->port =3D ce->local_port; } } @@ -3777,7 +3777,7 @@ { for (i =3D 0; i < o->ce.local_list->len; i++) { - options_postprocess_mutate_le(o->ce, o->ce.local_list->array[i= ]); + options_postprocess_mutate_le(&o->ce, o->ce.local_list->array[= i]); } } else -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/875?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I0542df021ae0ba9c982335fed7bbd10ed326dd0f Gerrit-Change-Number: 875 Gerrit-PatchSet: 1 Gerrit-Owner: its_Giaan Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange --dwe3qv+v7k4= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld, plaisthos.

its_Giaan would like plaisthos and flichtenheld to review this change.

Vi= ew Change

Fix PASS_BY_VALUE issue in options_postprocess_mutate_le()
Fix issue reported by Coverity:
CID 1641424: Performance inefficien= cies (PASS_BY_VALUE)
Passing parameter ce of type "struct conne= ction_entry"
(size 208 bytes) by value, which exceeds the low threshold of 128 bytes.

Commit 8466c2ca unintentionally introd= uced a performance
penalty due to passing struct connection_entry 'c= e'
by value to options_postprocess_mutate_le().
fix this by passi= ng 'ce' by address.

Change-Id: I0542df021ae0ba9c982335fed7bb= d10ed326dd0f
Signed-off-by: Gianmarco De Gregori <gianmarco@...2804...= .>
---
M src/openvpn/options.c
1 file changed, 3 insertions(+),= 3 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn r=
efs/changes/75/875/1
diff --git a/src/openvpn/options.c b/src/openv=
pn/options.c
index c938999..bd5c056 100644
= --- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -3323,12 +3323,12 @@
}

static void
-options_postprocess_mutate_le(struct connection_entry ce, struct loca= l_entry *le)
+options= _postprocess_mutate_le(struct connection_entry *ce, struct local_entry *le)=
{
/* use the global port if none is = specified */
if (!le->port)
{<= /span>
- le->port = =3D ce.local_port;
+ = le->port =3D ce->local_port;
}
= }

@@ -3777,7 +3777,7 @@
= {
for (i =3D 0; i < o->ce.local_l= ist->len; i++)
{
- options_postprocess_mutate_le(o->ce, = o->ce.local_list->array[i]);
+ options_postprocess_mutate_le(&o->ce, o-&= gt;ce.local_list->array[i]);
}
= }
else

To vie= w, visit = change 875. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0542df021ae0ba9c982335fed7b= bd10ed326dd0f
Gerrit-Change-Number: 875
Gerrit-PatchSet: 1
Gerrit-Owner: its_Giaan <gianmarco@...2786...= ..>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-MessageType: newchange
--dwe3qv+v7k4=--