Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sEiqY-003DPm-7J for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Jun 2024 05:06:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sEipZ-0055xS-NR for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Jun 2024 05:05:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sEipZ-0055xJ-DQ for pgsql-hackers@lists.postgresql.org; Wed, 05 Jun 2024 05:05:01 +0000 Received: from wfhigh2-smtp.messagingengine.com ([64.147.123.153]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sEipW-0004A5-ID for pgsql-hackers@postgresql.org; Wed, 05 Jun 2024 05:05:00 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailfhigh.west.internal (Postfix) with ESMTP id 1A40918000F6; Wed, 5 Jun 2024 01:04:56 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 05 Jun 2024 01:04:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1717563895; x=1717650295; bh=++NA2QWRMF Mj8ixFILPZovSD22j0S5VX4vXfrsGutOw=; b=BLoxpJUR/ePBF9JPkGjNPbqK90 dlK1Cf5OfM8vesu+IzjtHm8sPbminXaB8f8syt4Mhak4cYkQCze2l5u+S4yX2mVe sMDLNdWv9rE2pRwrNaemyQBCiHZEFUt50TrbDxPSkILPtXur0rTVh2MwD3esIBuD 3zdr8u9ge9ykZg7SU/P0ejLE4/Fl+FVk2C5nt5qhOxC07LJbwLxGVFN6pz8iPgky Itcr4D/8mG8hrJTHCbeyzC05dJ84cEPGGgEV8KQJT1p1sXr5j9wUbBwdAYxyirQw /ouKDhjBSYpXe+UFdg3DJAErwm7oon/j1D0DmvEDwyuYSGfjng8+wuoLe8KQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1717563895; x=1717650295; bh=++NA2QWRMFMj8ixFILPZovSD22j0 S5VX4vXfrsGutOw=; b=QI8UjTmAfR1zVdoKNHpPhUos3dA7eHpi45h3/R1xxSud L5lE/WpHJ8y/a9vJa8mu5K2CSVp87d6PQ81imwOmLq+kvQUBm/kWoVcz/zXjqfZW bV2zVQgRYb72IVZ1OJT/OAglWwcbM7mXOPrC60JEQVo+Ap5c/sByuugcBkyqUgDE 9cxE6zUAijntUN1WB2yufpUWMe5MQsKi4O2UPCq9DWxRbXqEF36VmW4a7QGmWJxq dl7BlgEO+9CZpyC46nVHI7V9B4/M4PGDHyTG1/lCd7BWvX5gAyWZZnJc12ChkB2G RanDUrT1xF0bzrxnl7g5RTmHvd5PcAbXxHFBXFTBdA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdelhedgleduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdlfeehmdenucfjughrpeffhf fvvefukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfrrghq uhhivghruceomhhitghhrggvlhesphgrqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvg hrnhepteelieefudffhffhtdetleeggeegfffhkeeuveetiefgudduvedutefggeeivdej necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhhitg hhrggvlhesphgrqhhuihgvrhdrgiihii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 5 Jun 2024 01:04:54 -0400 (EDT) Date: Wed, 5 Jun 2024 14:04:39 +0900 From: Michael Paquier To: Kyotaro Horiguchi Cc: ranier.vf@gmail.com, pgsql-hackers@postgresql.org Subject: Re: Fix use of possible uninitialized variable retval (src/pl/plpgsql/src/pl_handler.c) Message-ID: References: <20240605.131241.1337361574087593814.horikyota.ntt@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="xO9NpcoYGZ5VfYnV" Content-Disposition: inline In-Reply-To: <20240605.131241.1337361574087593814.horikyota.ntt@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --xO9NpcoYGZ5VfYnV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jun 05, 2024 at 01:12:41PM +0900, Kyotaro Horiguchi wrote: > At Mon, 27 May 2024 11:31:24 -0300, Ranier Vilela w= rote in=20 >> The function *plpgsql_inline_handler* can use uninitialized >> variable retval, if PG_TRY fails. >> Fix like function*plpgsql_call_handler* wich declare retval as >> volatile and initialize to (Datum 0). You forgot to read elog.h, explaining under which circumstances variables related to TRY/CATCH block should be marked as volatile. There is a big "Note:" paragraph. It is not the first time that this is mentioned on this list: but sending a report without looking at the reason why a change is justified makes everybody waste time. That's not productive. > If PG_TRY fails, retval is not actually accessed, so no real issue > exists. Commit 7292fd8f1c changed plpgsql_call_handler() to the > current form, but as stated in its commit message, it did not fix a > real issue and was solely to silence compiler. This complain was from lapwing, that uses a version of gcc which produces a lot of noise with incorrect issues. It is one of the only 32b buildfarm members, so it still has a lot of value. > I believe we do not need to modify plpgsql_inline_handler() unless > compiler actually issues a false warning for it. If we were to do something, that would be to remove the volatile from plpgsql_call_handler() at the end once we don't have in the buildfarm compilers that complain about it, because there is no reason to use a volatile in this case. :) -- Michael --xO9NpcoYGZ5VfYnV Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmZf8ecACgkQnvQgOdby QH0T6Q/+LGeaYtBzOTlCNEoCpLGACXnu3HpU7tAf62cJ6l5eWhi7ti89ElyvWEs6 uZTFk5zBsxpxvEvOFBmEF2S123LiBqxk5V9Sp/JWgbl8/zL+2GTsuAo2N4S9htLZ TTrjQxm2uDTjjAtKGVUgYlGv37AA8XTULZ5LFL5XYKlA3Ak08MdbktR253qdEJeH ul/1nPO2NeSVmFRKmt6ua5omLNcjqxjCM5R0OLt5lh59JIAc3E7bkOOTkXqeDRrA kvhKnI9RFUuyfemGjCd8HObbFm1sU5bYdLTmwmILdLAqeQKVs6Nk7tQPcplNcPBZ mIHPzG9B3xBGk7fRbI5vs9FIKFFx7CrRs1MXK5rfGwwt3WxeZBp7AVLQvGDlhz+R N8y3ptAz/SLNrTtfC+MMwuMTkH3YkulcPvQkf7tB8cixRwawB+niiHw3veK8YEIY zbkYKEg29eAuOsSLvWz0Ks4HQ6OYgCFMUj8JgQQdruw1LAbMPHiwQ2b+cZiaGq3b N1Z/1WSOnWXSuU1DsJtfQLRf4USIKONEMX2OdILg0+nEuToCEsMpnwH/+QVwFJO0 6rE06npO8G6AOOPJQx1cbxcSGRoNlNJh7t3YAVThWMoXRMk19JAH+Tu+fTf8EBKv 8TDFI6eYDYcEL3h98qXQJUKjJeFY7wZMLv3zW7woLPuLuBZnZxQ= =HdOE -----END PGP SIGNATURE----- --xO9NpcoYGZ5VfYnV--