From patchwork Wed Sep 25 15:11:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 3876 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:6c93:b0:5b9:581e:f939 with SMTP id p19csp387425may; Wed, 25 Sep 2024 08:11:28 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV7cffxO6zrMG4/jFgdsv8CaqKq30bcrBWyFDGkrcvuyVqj7eEqWEBomFc70xUO1IJ9oSd/H77azPo=@openvpn.net X-Google-Smtp-Source: AGHT+IFVPw1vNHl61iX6+a8R+ta9SBXQQ3PmLNPzWqgQfyNmapEuzDInt8AW4RgeD7Pk2droJzhK X-Received: by 2002:a92:ca0c:0:b0:3a1:95d9:6f36 with SMTP id e9e14a558f8ab-3a1a30679cdmr55293845ab.13.1727277088109; Wed, 25 Sep 2024 08:11:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727277088; cv=none; d=google.com; s=arc-20240605; b=UESvRdx4bV2kv5yDz1EjzOkaRKhFAGn6YJk0Jr8d2Li/yp4WqQwbeXMGBu0xqHK0rc ZDlbB+dtfqEQU3RIkHoW037Onk0nVlQpIJOfkZEYKmzp++hnOvvGD9TgboLntKAa8U82 VuFrVm+au6Kald5B24+6/4xSAqKMwe75lOHMRgHVIH9y3iPgpPByusLAZnY4uZq5RdDh C6j1DASlbEioAsg8GiXAhRqTG5jCjqY8nFoOL+cWB/hlLZd23vy5swmPKKoriTem96gg GMLXd5yJ3g4Ap44yJKJKcnXp2zYG9nSnLh2XPxqaqQHGHWHKS2IvBH13V6nH81xRmHwK s4VQ== 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=FvunrtkOiggVj8JUtq7BY0Z2IUdIQbHOBLjy1l/j10M=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=T/W+xWHXchP+icpySNKdkDY/rZUOb4MhczCV3o2m2bH8UwvL8Z7m9deVbCfOIsHUC+ JHUuMXoi7/MQBPFv2UzkPEnH3ZaPW7baHoGpDzLVtouGANUOGf02uV8uEQ+nqwy83hnQ cgq1Wq0xQdbbg8XrcxDjkBoYCjXfJFjXJyf2wFJzbCDfG+Ryx11Er2kxiRjUwvc5+0TA itKlpaTcer6kxGNMROLO03d5glU2tngYhcaH0ybBnKJyCkNAsGrgtk3H3IBvCKoWv+Ve BwQJqrRSNzQctYicigbpBCC2++MUECp3q3j23QS0hvnKY/q8QKbhGEwvdwRHIVbnFtF8 DbKQ==; 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="FPWxrJJ/"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=e4LBu1y6; 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 8926c6da1cb9f-4d40f4bdd08si2104129173.180.2024.09.25.08.11.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Sep 2024 08:11:27 -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=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="FPWxrJJ/"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=e4LBu1y6; 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-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1stTfm-0000Yz-1j; Wed, 25 Sep 2024 15:11:22 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1stTfj-0000Yt-Jk for openvpn-devel@lists.sourceforge.net; Wed, 25 Sep 2024 15:11:19 +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=huM4lT8/70EZzVbdqrpobMX+Ci3Jx5I1psXskM/rr6M=; b=FPWxrJJ/CwNo/fh2rBvtc8wMbz 2au3hCJeeWyETPqrxxy3aVPOqUgRg3zDB6ifjaTrccpQp6oJxcES03szu08Ge964Xky7Q/g8MLvVa ShWXOwl6Ghgaemf76r4Eu2vY8MMraNUGb7nHQtBQ9MbewiibteAWFILBWXA6Am+md+g8=; 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=huM4lT8/70EZzVbdqrpobMX+Ci3Jx5I1psXskM/rr6M=; b=e4LBu1y653dFZgFSNScKqCc6Ds auxcCOV9MxlvHyZ1tS05IpUoLmU7bSDT2uLaA4jrvBkpMEHSfDpmk6lM6ABIXiGv4Dg1EpjLH/uT1 +tcax+NLAJLeGPhptEb0wlMl4g6O60Lt7itmj+wkQACCKLN7bjLMLbDQRV9ELlDJrgu0=; 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 1stTfh-0000V1-7g for openvpn-devel@lists.sourceforge.net; Wed, 25 Sep 2024 15:11:19 +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 48PFB5ZX013046 for ; Wed, 25 Sep 2024 17:11:05 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.17.1.9/8.17.1.9/Submit) id 48PFB56B013045 for openvpn-devel@lists.sourceforge.net; Wed, 25 Sep 2024 17:11:05 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Wed, 25 Sep 2024 17:11:04 +0200 Message-ID: <20240925151104.13036-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.44.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: Arne Schwabe If we indicate that the tun device has been opened the c1.tuntap struct is guaranteed to be defined. This extra null check is something that Coverity flags as we access a do a null check after already [...] Content analysis details: (-0.0 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-Headers-End: 1stTfh-0000V1-7g Subject: [Openvpn-devel] [PATCH v1] Remove null check after checking for checking for did_open_tun 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?1811181299685084444?= X-GMAIL-MSGID: =?utf-8?q?1811181299685084444?= From: Arne Schwabe If we indicate that the tun device has been opened the c1.tuntap struct is guaranteed to be defined. This extra null check is something that Coverity flags as we access a do a null check after already accessing fields of tuntap Change-Id: I9966636163c7dfa208d26f1cadbf5b81937f3a34 Signed-off-by: Arne Schwabe 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/+/772 This mail reflects revision 1 of this Change. Signed-off-by line for the author was added as per our policy. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 876edad..ae911a9 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -2546,10 +2546,7 @@ { event_timeout_init(&c->c2.route_wakeup, c->options.route_delay, now); event_timeout_init(&c->c2.route_wakeup_expire, c->options.route_delay + c->options.route_delay_window, now); - if (c->c1.tuntap) - { - tun_standby_init(c->c1.tuntap); - } + tun_standby_init(c->c1.tuntap); } else {