From patchwork Wed Sep 24 14:57:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4448 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:c08a:b0:72f:f16c:e055 with SMTP id jr10csp1606814mab; Wed, 24 Sep 2025 07:57:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW4dywYDGmAzQeY4KIv6cRDar4/SWPUj0wgVcQvucJrNxTJ1HUpn9xEwBxC4LypI+F4IgcnQTuNrjU=@openvpn.net X-Google-Smtp-Source: AGHT+IGeY+GfDjjxTWzx3SZfzx9T45IM+72T5PoJ89KOx2CajkqpKWR3+f8SELGlTs7uzYnTB6q+ X-Received: by 2002:a05:6870:c48:b0:332:75df:ab9f with SMTP id 586e51a60fabf-34c859e7fb0mr4032436fac.38.1758725855008; Wed, 24 Sep 2025 07:57:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1758725854; cv=none; d=google.com; s=arc-20240605; b=FnZmwuLTvOmhFbY7h8OTVEZj9ru/bJ/jOZc1M+pqOBb6wQcYE61YyDfV5RbugVNQzJ 4cXnZJkIPlrWVIc4NhOAXLX6bR9Ev5hzM5q0WoDB7A7OVbwHCOhyseI/M6oVkz2r7BhL /otIgsg6Ai8SuAYrAHKAiMdhyU+/9ZbtrPcoyD1zISGKIRg2fRIcmaszOkvK6ro1cIrL fmT579FqquwBTfzufHPcWsL1fM47+P7Z0ggD0Dy6ffsF4E0uRVWDgCrs+jpUMQ/IDjdx 9iknOUyzZFxL0c9ZG+49olnkr4w3wIfuBp+xou5uGq1RpRxAilMOLcZpiqbXI8h9r4mz nIUw== 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:dkim-signature; bh=gMx9TqYYlqKXy/jqfbxm+V1whh/0J3NYKVjBS+zpv3M=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=BUizFn4dKhAHd414jblcQEKAgNNjzRObC0jNyAenOaP/6A6Z2igCmGo6ITBj2BJcTV K3OVLnGaagCMtQI3P0e5Avkwz4kkdMgqtqw7W0F30tqOikc2yXUZr+iaeoNMcRa4/tpN MOWNg229CSYpvKTY5CCXDFuHHbLeeZhqdqZFCIe4YHyqh76RGnDBVRdZHQnmIXuYlZGL SsDVSETdph4/GNQVSDdRmrqe8DuZ5Vd0hcdu6ckEXyaMvDjrUDJW7lhn5Hyg9FGJNIPM MBd5fE4Pw11b/ADO3RlFXh1aQGDBVb7w1M+qDyHP3Kf05TJEyf9oR1gZtxsx+sGHe0Jo iD6A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=HmV7IziO; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=NUGRM0i0; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=Jz0VB+e3; 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 586e51a60fabf-3499218eb29si1934120fac.86.2025.09.24.07.57.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Sep 2025 07:57:34 -0700 (PDT) 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=pass header.i=@lists.sourceforge.net header.s=beta header.b=HmV7IziO; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=NUGRM0i0; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=Jz0VB+e3; 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 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:References:In-Reply-To:Message-ID:Date:To:From:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=gMx9TqYYlqKXy/jqfbxm+V1whh/0J3NYKVjBS+zpv3M=; b=HmV7IziOumdGyAL3yBzWFV6+In q/cs8SSM2YtxXi5kHe+pS+dc2hhmzv34K+xlWpoBppxX9Xp8w8ItMQfSJqc5YjAenlyN8ExUB46yc G8hhnWbbu9ktWL3fiN8prmKQ7D73Xfucetp7lZhuXVtwr5xEmHBDvfqE2YEoZwpzCNLE=; Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1v1Qvz-0001Fj-Jf; Wed, 24 Sep 2025 14:57:31 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1v1Qvw-0001Fa-Jx for openvpn-devel@lists.sourceforge.net; Wed, 24 Sep 2025 14:57:28 +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=xuw409UAHWcWmjMjWu3ek0DhPMu350Jf/EtzABnR1ys=; b=NUGRM0i0tS7GHyFpB0yOAj8o96 Ow3tRlS0zTA8vpc59UhV4YGho97DZPOQWfCfac1uEjGoxoxzL6FAIOgZRW1DJe32qQCrKKr5zCorH LH7ChXIlWNH+zJFlqcC+PElvhd6Uy+UFDnf2oasKLVzHQuq/TEKOAXRQvhwBZzGlN1/Q=; 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=xuw409UAHWcWmjMjWu3ek0DhPMu350Jf/EtzABnR1ys=; b=Jz0VB+e3b2uQbJ/k5sQj/5PzoE ljEauwiUOy78B8h16hnahXX7D9OrUM+Hv0M3M4Zoi3NpaTEScdBWtdFAm4YbTqzADk6sodrTVhaAx t7JsqZwR29B0zySBq5vn+Uffqi72M7bXwV4JE7pKXVRTEQEzXMCrnZ1TuwPmtKtfxtTI=; Received: from [193.149.48.134] (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 1v1Qvv-0001h3-HO for openvpn-devel@lists.sourceforge.net; Wed, 24 Sep 2025 14:57:28 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.18.1/8.18.1) with ESMTP id 58OEvFFb028716 for ; Wed, 24 Sep 2025 16:57:15 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 58OEvFQd028715 for openvpn-devel@lists.sourceforge.net; Wed, 24 Sep 2025 16:57:15 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Wed, 24 Sep 2025 16:57:09 +0200 Message-ID: <20250924145715.28701-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.49.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-2.hosts.colo.sdot.me", 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: Frank Lichtenheld The APIs want int (at least on unixy systems), so we use int. max_int() protects us against negative values. Change-Id: Ie8a242838b6f8b42f36327c33fc62bb5f94ec43f Signed-off-by: Frank Lichtenheld Acked-by: MaxF Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/ [...] Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1v1Qvv-0001h3-HO Subject: [Openvpn-devel] [PATCH v8] event: Silence conversion warning in tv_to_ms_timeout 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?1844157722152128709?= X-GMAIL-MSGID: =?utf-8?q?1844157722152128709?= From: Frank Lichtenheld The APIs want int (at least on unixy systems), so we use int. max_int() protects us against negative values. Change-Id: Ie8a242838b6f8b42f36327c33fc62bb5f94ec43f Signed-off-by: Frank Lichtenheld Acked-by: MaxF Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1178 --- 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/+/1178 This mail reflects revision 8 of this Change. Acked-by according to Gerrit (reflected above): MaxF diff --git a/src/openvpn/event.c b/src/openvpn/event.c index 2f60b78..ca84d19 100644 --- a/src/openvpn/event.c +++ b/src/openvpn/event.c @@ -65,11 +65,15 @@ #define SELECT_MAX_FDS 256 #endif -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif +/** Convert \c timeval value (which is in seconds and microseconds) + to a value of milliseconds which is required by multiple polling + APIs. + @param tv \c timeval to convert + + @return Milliseconds to wait. Zero if \p tv is zero. + Otherwise the return value is always greater than zero. +*/ static inline int tv_to_ms_timeout(const struct timeval *tv) { @@ -79,14 +83,11 @@ } else { - return max_int(tv->tv_sec * 1000 + (tv->tv_usec + 500) / 1000, 1); + /* might overflow but not for practically useful numbers */ + return max_int((int)(tv->tv_sec * 1000 + (tv->tv_usec + 500) / 1000), 1); } } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - #ifdef _WIN32 struct we_set