From patchwork Wed Sep 24 08:21:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4444 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:c08a:b0:72f:f16c:e055 with SMTP id jr10csp1391335mab; Wed, 24 Sep 2025 01:21:37 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXkvB8S5uazcyR3LEiRJ6WkIWSO2pKRMoLe0XQNSmMN0jpPvg07vrPzPX4DWGXmPbASnq1xLTtFU24=@openvpn.net X-Google-Smtp-Source: AGHT+IG/NAAvIqAhmrcWJ+QIB32dP+LDFYVd2E8iu8us3troMR5DgS/qEYykVNpExqx+gE1MQfQa X-Received: by 2002:a05:6830:314f:b0:79a:c31:e659 with SMTP id 46e09a7af769-79a70854b40mr1057893a34.18.1758702097507; Wed, 24 Sep 2025 01:21:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1758702097; cv=none; d=google.com; s=arc-20240605; b=XPM4AnPeUCArrPB4L9cWKqGz/j6zYSfXUtm2fGHo/lDoMbGAlkvrUqok4Fru8JBAgI 2lsWbR6Vu3Bi4djVz3tyhymEF5EZGaPSj5WtaISsyqGKNGemdCfdg8b8ODXo/tfwq3ZN lhu3W4sC5Km3OAHyqCHtMuJzwxQ2b/VABTA0oEbXtVX/h5+ZMtMfwpqs0fxopwr+5jr4 pMEpNYuOuEelhAYAKoKkqRLXMyigSQYvsvAOwFrMwlx6Yrl7KNUiqmyZP4l9ilCrBRNr JRlCqfpAmWPU3bLGSuApOADCk67i7ApmSCBELC1Awvjw4w/7QG8yuOGOz06PyebADt6h YRHA== 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=l6Slvpv4+XY9v6SsnHTwDMZ8hcH52wd9m1FRKJOikGg=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=VfjD5KaSOjFrxTTQndiloojmvmVm5yTHdzNULXpweRXh7V+Xhrw46aH8HSStP3XCKB EH5REslDCLL6lpm48OE4W1OAONmOBjpXWkdSsW7XJzdYO0cSP7DAbsOL2IeZa+RQ/PkG I2GgLQNlRUJhljdkMLHExcqpO/gUpknQToWHAZNJ32ETz2Vdm6p3yq5ucOjX6h4HlKvN G2Yry/c3kCirSEmZwMzoxUwTTQBuC5ln44c/q5uf25nPW37veoJYtrHFLcai8ifZ6KnC UjZFXwLX2NRBVdH2zqhNtHblaHgPyOwPDernWAUHj+m/ZIXlXtNq3EIMlnZHH4fJCAoe 9x2g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b="FI/I7E37"; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="e/wDhAfp"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=TfwaEEIR; 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 006d021491bc7-636be6feac0si488325eaf.88.2025.09.24.01.21.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Sep 2025 01:21:37 -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="FI/I7E37"; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="e/wDhAfp"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=TfwaEEIR; 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=l6Slvpv4+XY9v6SsnHTwDMZ8hcH52wd9m1FRKJOikGg=; b=FI/I7E37LEr84HHSjSB5C4lofe r1ur7Xjv5PjucM/wo8DQQDk5n/0MfgNJbdY6+DNZTSBTOHDKX3gQ06XaJTnwhA4PVUC152qUGstPK 4qW/B0zKN2XrHUI11w7ssKZyabsQ4ReSMXpBG9s13ZLoGUoDe9oFoIY/UAyQ83J81560=; 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 1v1Kko-0000Zx-UI; Wed, 24 Sep 2025 08:21:35 +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 1v1Kkn-0000Zg-CK for openvpn-devel@lists.sourceforge.net; Wed, 24 Sep 2025 08:21:34 +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=zMtyKVhHvUUz0r/qbFJ76072wXAzRIR1YhYyeprTuQU=; b=e/wDhAfposiPSWpU/6y+gMmEG+ ich12/DfMgjpNvf8mho2EMDQi+Ir+2QI0LRPmaH+pIixZtHGh28hpklU0CANtrHwiaxfj+wr3MJxn IiMDPUjiLpQOzYN5KlOKV8mfSUAUtzVeC+2Rde54vPoALw4DeX4gvulPPWdomFiho7Dw=; 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=zMtyKVhHvUUz0r/qbFJ76072wXAzRIR1YhYyeprTuQU=; b=TfwaEEIRnvy6MC44W8RzPi1j+W guaPcw+L3CVrm+LMx5D87C7gTs5etf/O+PHlDZuzgLq/2iSsEl1G3VIT6k/1we+YOK25O2/pUNiba B2cgd4qgFq2v/ILrLGoNSrOkY82JuQonb+Cx2x170WLOmPMyKwO7SiC/BY4rQWIxCzI8=; 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 1v1Kkn-0007SS-Ae for openvpn-devel@lists.sourceforge.net; Wed, 24 Sep 2025 08:21:34 +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 58O8LL32023156 for ; Wed, 24 Sep 2025 10:21:21 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 58O8LLAB023155 for openvpn-devel@lists.sourceforge.net; Wed, 24 Sep 2025 10:21:21 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Wed, 24 Sep 2025 10:21:15 +0200 Message-ID: <20250924082121.23139-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-1.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 We know that these values can't be big since they are limited to the size of the input buffer. So we can explicitly cast them to int if required. Change-Id: Id070d1a45d45f9029309d23df7f3cab9ce792205 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/open [...] 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: 1v1Kkn-0007SS-Ae Subject: [Openvpn-devel] [PATCH v7] ps: Fix conversion warnings related to send/recv return values 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?1844132810760146633?= X-GMAIL-MSGID: =?utf-8?q?1844132810760146633?= From: Frank Lichtenheld We know that these values can't be big since they are limited to the size of the input buffer. So we can explicitly cast them to int if required. Change-Id: Id070d1a45d45f9029309d23df7f3cab9ce792205 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1194 --- 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/+/1194 This mail reflects revision 7 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpn/ps.c b/src/openvpn/ps.c index 1d14367..31e7c25 100644 --- a/src/openvpn/ps.c +++ b/src/openvpn/ps.c @@ -475,11 +475,6 @@ return true; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - /* * This function runs in the context of the background proxy process. * Receive a control message from the parent (sent by the port_share_sendmsg @@ -539,7 +534,7 @@ if (status >= 2 && command == COMMAND_REDIRECT) { - buf.len = status - 1; + buf.len = (int)status - 1; if (proxy_entry_new(list, es, server_addr, received_fd, &buf, journal_dir)) { CLEAR(buf); /* we gave the buffer to proxy_entry_new */ @@ -566,7 +561,7 @@ proxy_connection_io_recv(struct proxy_connection *pc) { /* recv data from socket */ - const int status = recv(pc->sd, BPTR(&pc->buf), BCAP(&pc->buf), MSG_NOSIGNAL); + const ssize_t status = recv(pc->sd, BPTR(&pc->buf), BCAP(&pc->buf), MSG_NOSIGNAL); if (status < 0) { return (errno == EAGAIN) ? IOSTAT_EAGAIN_ON_READ : IOSTAT_READ_ERROR; @@ -577,8 +572,8 @@ { return IOSTAT_READ_ERROR; } - dmsg(D_PS_PROXY_DEBUG, "PORT SHARE PROXY: read[%d] %d", (int)pc->sd, status); - pc->buf.len = status; + dmsg(D_PS_PROXY_DEBUG, "PORT SHARE PROXY: read[%d] %zd", (int)pc->sd, status); + pc->buf.len = (int)status; } return IOSTAT_GOOD; } @@ -587,7 +582,7 @@ proxy_connection_io_send(struct proxy_connection *pc, int *bytes_sent) { const socket_descriptor_t sd = pc->counterpart->sd; - const int status = send(sd, BPTR(&pc->buf), BLEN(&pc->buf), MSG_NOSIGNAL); + const ssize_t status = send(sd, BPTR(&pc->buf), BLEN(&pc->buf), MSG_NOSIGNAL); if (status < 0) { @@ -596,17 +591,17 @@ } else { - *bytes_sent += status; + *bytes_sent += (int)status; if (status != pc->buf.len) { - dmsg(D_PS_PROXY_DEBUG, "PORT SHARE PROXY: partial write[%d], tried=%d got=%d", (int)sd, + dmsg(D_PS_PROXY_DEBUG, "PORT SHARE PROXY: partial write[%d], tried=%d got=%zd", (int)sd, pc->buf.len, status); - buf_advance(&pc->buf, status); + buf_advance(&pc->buf, (int)status); return IOSTAT_EAGAIN_ON_WRITE; } else { - dmsg(D_PS_PROXY_DEBUG, "PORT SHARE PROXY: wrote[%d] %d", (int)sd, status); + dmsg(D_PS_PROXY_DEBUG, "PORT SHARE PROXY: wrote[%d] %zd", (int)sd, status); pc->buf.len = 0; pc->buf.offset = 0; } @@ -797,10 +792,6 @@ msg(M_INFO, "PORT SHARE PROXY: proxy exiting"); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - /* * Called from the main OpenVPN process to enable the port * share proxy.