From patchwork Fri Jan 24 13:00:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4076 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:c127:b0:5e7:b9eb:58e8 with SMTP id jm39csp800005mab; Fri, 24 Jan 2025 05:00:18 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUZ0WMkK5UptrO3FjTrPM42xb4HOrtfnqjFjyswaHUxRBykfJLp8d9ZfByjaMIFSLJaA3OZMHHbQvM=@openvpn.net X-Google-Smtp-Source: AGHT+IH32DwUhBhXln/rX/BiogwqlcW0vFjMgu9WNppLqXltAFEQH+SPzbKpyhIWU/RtuGo2Kav2 X-Received: by 2002:a05:6820:8c6:b0:5fa:67a9:8593 with SMTP id 006d021491bc7-5fa67a986d0mr9725063eaf.2.1737723618557; Fri, 24 Jan 2025 05:00:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737723618; cv=none; d=google.com; s=arc-20240605; b=OrbMZmKeYwfP1uUIKAbyHfCOa4lwhjGpx7IaXCSgdGzhtB5hPjlscIK2YceHBu8XHK sGHvXPJpHtredeGSO3FCcPfRy1ZGQTGoOGjTvIkzVhpHaid5kOUy04eqfHaluUY1RIDv zUI1T7f+cNlLMyt4bevZsRJ/jvHZmNuPbD68s9SS6aAyepDW2Kd6tw50djjozAa7jKNV 4SPyLXicq11k41q/0Exj0+jR/e9WrCLIOwI8YpHkYKc9q/t0AhDzldCg8HtE4KY/xPO+ p8mAcHqUxfWunng/iW+Nu6LKpx+HRfaoOP4xXnq8jE4lEKgjl+huiTv17OqFt43MEAqP pXpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature; bh=GGkXAf5HJ2hDQkbfAEBc4f5ZbJLGafYR9vcqszoZ3Is=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=ieeCcjvNNtBzia1zftxV6G2dBO4EAe9kSo0mjZbvBBwqxk9dCcjidySxHJqJAe1B9x XZxWIEgjQwKTJtSBIG4dO5THq+T51DoNst/QjyE83CKVvrK3y6XSIxPjnaGj4emILP/j +ljttVjw1G6wHs/XwN4IA8AUNLmBPdNiAdS00zNjV3OCv0hDIyw9PUm4xmljJGkVoVSK sspfOsfp6TVYc0i6ZMYyS99F11ld/KUYOdY+lzf/qTkLnlR35YpWdj86PVFOmsPO+xhj vAka+NMH30qjcTycRhIruu2JVUYYf5oi5qs4qcV1IX50kOcPzzX/IuCalZX6PPN6wgwH znNQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=g3BePLaO; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=MCJP5xAj; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 46e09a7af769-724ecfb5e36si1700484a34.266.2025.01.24.05.00.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jan 2025 05:00:18 -0800 (PST) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=g3BePLaO; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=MCJP5xAj; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1tbJID-0008Nf-ED; Fri, 24 Jan 2025 13:00:13 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tbJI9-0008NE-Ld for openvpn-devel@lists.sourceforge.net; Fri, 24 Jan 2025 13:00:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=GtsVUuMu2PpER3cl/29ervVj1Om6c8fUQy2kLFZKWho=; b=g3BePLaOQ9odaEECgRZ8X5oeI7 66/5DqjejijMrhChxa/lNA053ckWEQjHG2wwFMlMFnpoVAE96In3DWbwg0dTRGn8o3s1nCj1HLZJa oWnvNiZSkMf+Kb3n+KMLhBMKuZufKSxWWXc8b5988hrte54xm1//YH03DXBxfMPBfb5A=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=GtsVUuMu2PpER3cl/29ervVj1Om6c8fUQy2kLFZKWho=; b=MCJP5xAjv7uH6kIP+jHPrrePR9 3sJYmf2FKhxGh6q1ik+B7ptm2cLiLbGazNOyh2UXfMjJaaVI3ZrVh8uvKBZGTbQvGwNVnHf8Mjv21 LjsQnUfVlb9/QCG6G2KUD1q/FpPCCQZsEnYgp3pBO3PfsUp4anegk1eDLwaeJrqxV4r8=; Received: from dhcp-174.greenie.muc.de ([193.149.48.174] helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1tbJI7-0006lD-PH for openvpn-devel@lists.sourceforge.net; Fri, 24 Jan 2025 13:00:09 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.17.1.9/8.17.1.9) with ESMTP id 50OD01os020104 for ; Fri, 24 Jan 2025 14:00:01 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.17.1.9/8.17.1.9/Submit) id 50OD01O0020103 for openvpn-devel@lists.sourceforge.net; Fri, 24 Jan 2025 14:00:01 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Fri, 24 Jan 2025 14:00:00 +0100 Message-ID: <20250124130000.20067-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: -0.0 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-2.v13.lw.sourceforge.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Gianmarco De Gregori 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 threshol [...] Content analysis details: (-0.0 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [193.149.48.174 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [193.149.48.174 listed in bl.score.senderscore.com] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Headers-End: 1tbJI7-0006lD-PH Subject: [Openvpn-devel] [PATCH v1] Fix PASS_BY_VALUE issue in options_postprocess_mutate_le() X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1822135281123844208?= X-GMAIL-MSGID: =?utf-8?q?1822135281123844208?= From: Gianmarco De Gregori 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 --- 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/+/875 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering 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_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) { - le->port = ce.local_port; + le->port = ce->local_port; } } @@ -3777,7 +3777,7 @@ { for (i = 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