From: "cron2 (Code Review)" Date: Fri, 24 Jan 2025 14:01:00 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., gianmarco@...2726..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <8a12d4f6290ca8d76ca3a358d952e195c781c31a-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="TQ9UyhjIDj8="; 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: its_Giaan Cc: plaisthos , flichtenheld , openvpn-devel --TQ9UyhjIDj8= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/87= 5?usp=3Demail ) 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 Acked-by: Gert Doering Message-Id: <20250124130000.20067-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg30= 566.html Signed-off-by: Gert Doering --- M src/openvpn/options.c 1 file changed, 3 insertions(+), 3 deletions(-) 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: 2 Gerrit-Owner: its_Giaan Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: merged --TQ9UyhjIDj8= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 submitted this change.

View Change

Fix PASS_BY_VALUE issue in options_postprocess=
_mutate_le()

Fix issue reported by Coverity:
CID 1641424: Perform= ance inefficiencies (PASS_BY_VALUE)
Passing parameter ce of type &qu= ot;struct connection_entry"
(size 208 bytes) by value, which ex= ceeds the low
threshold of 128 bytes.

Commit 8466c2ca uninten= tionally introduced a performance
penalty due to passing struct connecti= on_entry 'ce'
by value to options_postprocess_mutate_le().
fi= x this by passing 'ce' by address.

Change-Id: I0542df021ae0b= a9c982335fed7bbd10ed326dd0f
Signed-off-by: Gianmarco De Gregori <gian= marco@...2726...>
Acked-by: Gert Doering <gert@...1296...>
M= essage-Id: <20250124130000.20067-1-gert@...1296...>
URL: https://w= ww.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg30566.html
Si= gned-off-by: Gert Doering <gert@...1296...>
---
M src/openvpn/o= ptions.c
1 file changed, 3 insertions(+), 3 deletions(-)

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 voi= d
-options_postprocess_= mutate_le(struct connection_entry ce, struct local_entry *le)
+options_postprocess_mutate_le(str= uct connection_entry *ce, struct local_entry *le)
{=
/* use the global port if none is specified */
if (!le->port)
{
- le->port =3D ce.local_port;+ le->port =3D ce-&g= t;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->arra= y[i]);
+ o= ptions_postprocess_mutate_le(&o->ce, o->ce.local_list->array[i= ]);
}
}
= else

To view, visit change 875. To unsubscri= be, 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: 2
Gerrit-Owner: its_Giaan <gianmarco@...2786...= ..>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: merged
--TQ9UyhjIDj8=--