From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id 1ABAC3858D1E for ; Sun, 23 Oct 2022 15:16:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1ABAC3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org Received: by smtp.gentoo.org (Postfix, from userid 559) id AC6DB340AEC; Sun, 23 Oct 2022 15:16:00 +0000 (UTC) Date: Sun, 23 Oct 2022 19:46:34 +0545 From: Mike Frysinger To: Andrew Burgess Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 04/10] sim/ppc: don't pass uninitialized value to semctl for GETVAL calls Message-ID: Mail-Followup-To: Andrew Burgess , gdb-patches@sourceware.org References: <5155a6bb36800aa1a8bdb214f59f85f9d92b6989.1666192979.git.aburgess@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="2xZGb9GcVwtEPc1B" Content-Disposition: inline In-Reply-To: <5155a6bb36800aa1a8bdb214f59f85f9d92b6989.1666192979.git.aburgess@redhat.com> X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --2xZGb9GcVwtEPc1B Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 19 Oct 2022 16:24, Andrew Burgess via Gdb-patches wrote: > When calling semctl with an GETVAL action, the 'union semun' argument > is unused. >=20 > Rather than passing an uninitialized variable (as we currently do), > just pass the integer 0. This silences some compiler warnings, and is > just as correct (given the argument is ignored). >=20 > To be honest, it might be the case that the argument is not needed at > all, however, I'm a little nervous to make this change as the amount > of testing I can do of this code is limited. Every example I found > online for a semctl/GETVAL call did pass the final argument, so that's > what I've continued to do. the semctl prototype is: int semctl(int semid, int semnum, int cmd, ...); i would just delete the 4th arg, but if you really want to keep the 0, OK. -mike --2xZGb9GcVwtEPc1B Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEuQK1JxMl+JKsJRrUQWM7n+g39YEFAmNVST4ACgkQQWM7n+g3 9YFkvw/+LNY5bJskYk2rg/+lnEeUvIvz8O4WI/Jx94w+IKNpnqwwUtkyxqUb4GHt f2hCHi4FVXaHuIS1uKoQUpuEQTNW7dBz8ij8F1pGPs98Opob1Ql+aRTIDUnvcbgd Dx1mBLmgt5exUcbj3+2N+YXfUSK7/FZaGsZXearStshW6YBSin+5MAYEDhecx+hp 5xzczOhqmxJt/rdmRvRSW540/ghIsP1Rw96gtoqlXGRp9wSYAUOHHTWlG4ssBjRP yZDUD1U3sqDrOizPcAdATYKD/Wumy9aVlRkk2RRi6CJvsrz9GacRlBtsBWS7Zi+N ce3CY/7YAX15pgG3rBB+4hTOok7N9hwRI+7vyDxR4kI1WwciooLCXiyz/6dB6Q7d y4Vya0mKPGtsVoeYP0fjn6eKu0E9RmT+Zl0QgKRLnT68ipZTrmeAoZFLevIPCx4I 5tGNfOwKQJBen6hBhswnmrc/3U2iPC2lG+SyKVsEUwcM3ZJTKn5lqvWijF8QogZz 2xzkCysGwOSnuOU806+58536OJu9BODU94MGrBV+k1pxTLAUgFShPB81AE6YoZhW 3+6c5gFhyRDmcgVgrDAQZwhVcToi8/5hwXXurCa1wp2g2WrXm+akwwPPP/GAXRib cYbY+VhLD+zipG7/emIe+Qjv8bcjT4G+P4wlKlaskB8shpu9uTo= =qXxP -----END PGP SIGNATURE----- --2xZGb9GcVwtEPc1B--