From nobody Fri Jun 30 21:52:37 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Qt8DF6TPWz4jypj; Fri, 30 Jun 2023 21:51:57 +0000 (UTC) (envelope-from rob.fx907@gmail.com) Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Qt8DF2zSrz436j; Fri, 30 Jun 2023 21:51:57 +0000 (UTC) (envelope-from rob.fx907@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-98de322d11fso64797066b.1; Fri, 30 Jun 2023 14:51:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688161914; x=1690753914; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=JPADjRtCiM64+La37rVdi5LUEwglBaSmNB9E/N2t+xs=; b=qJU2AgZjv48Z2Axpx0XO+ErhfPaX4AdQZ8IGwdI8Z/DG/k+duGLsM3oF2Dpk0Iwoj6 YLnkxu+Qrg5XqQCu4LdbFMh/5AexYlO8a3vAU4Kfk2aVmnoRhQbglJ3lgaTJuZOCim4F 9kU4lUPDdh9rs5+PQgpi0l26HPJMvtfDMfoR9upumWS47K0vQCX9ljVkbxWeC+JVQEfb NtYeWvHVWmr8zx0GCAAOMFGv2M3RDDnqL1m11e9jUJ2NBQfHIzgGhQcDzh6zq1FJgoak 2DKUxVaiNgXV1OdK9lzotX3BiOBk0ygG20taGAWy/gJ2X1cLXPLlsrr4w3/LWMFH2SoN 4hlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688161914; x=1690753914; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=JPADjRtCiM64+La37rVdi5LUEwglBaSmNB9E/N2t+xs=; b=KePBxCd0b5pLCyu9DrVxvmtAzSwiEVn5rC3GF+aEpJamSmAjNqe+39yf6jAx52ijs8 dwO/AiMzBKMkbkwWhcU9LsSoJORBMIpGuy6nBC0n7CAvwtCHwn2qWzyacQNK3HrzdMko PRZTdGqC3wd8VYHErukAqu79sCMWJ9O6zroRi9xmaxknPBvn84BpC+nHprpOKDsR+Z0W coPuKwSb0P5vnBtQGxcRc2eZum7CjnGwn75gvv3yNMu8VjRrR85aG/xw6xlOM4YqzwRE gBxo5s3axxi2Hx5ky+I0czLxxWt/3qZPYRvyi/ktZEy/qj5/kvaAuIULXWSIJ9KeTSRM 8XRQ== X-Gm-Message-State: AC+VfDw+v1HChSKp4muiPB4Qr1JPAniyKz1N1VwWFC3e2xFzv/QKC07Z eC4hUpT2gTjla3YtWN+qW/RioWkNi3X/woCT2G3APrsOJMDy9g== X-Google-Smtp-Source: APBJJlHR26NdI908eKaiVU1WBasoAHkI/H0IthAUMW9oVTU7cwLgG8q8jdkw9UEQsOLM/3WmtZpYQiUE4GhloOUDVxM= X-Received: by 2002:a17:906:aac5:b0:987:6960:36c8 with SMTP id kt5-20020a170906aac500b00987696036c8mr2754784ejb.7.1688161913719; Fri, 30 Jun 2023 14:51:53 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 References: <202306300652.35U6qpgP027126@gitrepo.freebsd.org> <667C347E-B7C7-405B-AFEC-F0A0FD0656F6@freebsd.org> <498f3ba2-dc7a-e7d3-626a-76ca68cee5b2@freebsd.org> <79845.1688159657@kaos.jnpr.net> In-Reply-To: <79845.1688159657@kaos.jnpr.net> From: Rob Wing Date: Fri, 30 Jun 2023 13:52:37 -0800 Message-ID: Subject: Re: git: 56f3f2d2491e - main - libsecureboot: avoid set but not used errors To: "Simon J. Gerraty" Cc: Jessica Clarke , Mitchell Horne , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Type: multipart/alternative; boundary="00000000000030d3d505ff5fd3a6" X-Rspamd-Queue-Id: 4Qt8DF2zSrz436j X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N --00000000000030d3d505ff5fd3a6 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Looking at this snippet: + if (!cn.status) { buf =3D NULL; + if (err =3D=3D 0) /* keep compiler happy */ + buf =3D NULL; + } return (buf); } And considering the comment at contrib/bearssl/inc/bearssl_x509.h , is it intended for buf to be returned as-is (i.e., not set to NULL) when the decoding status indicates an error condition? On Fri, Jun 30, 2023 at 1:14=E2=80=AFPM Simon J. Gerraty = wrote: > Jessica Clarke wrote: > > A conditional assignment of the same value that has already been > > assigned unconditionally is unidiomatic code generally regarded as a > > code smell and should be avoided. In an ideal world that would give a > > I agree. > > I've been bitten by __unused recently when porting stuff to linux > so was looking to avoid that. > > --00000000000030d3d505ff5fd3a6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Looking at this snippet:

+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (!cn.status) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 buf =3D NULL;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (err =3D=3D 0)= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* keep compiler happy */
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0buf =3D NULL;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return (buf);
=C2=A0}

And considering the comment at contrib/bearssl/inc/bear= ssl_x509.h, is it intended for buf to be returned as-is (i.e., not set = to NULL) when the decoding status indicates an error condition?


On Fri, Jun 30, 2023 at 1:14=E2=80=AFPM Simon J. Gerraty <<= a href=3D"mailto:sjg@juniper.net">sjg@juniper.net> wrote:
<= blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l= eft:1px solid rgb(204,204,204);padding-left:1ex">Jessica Clarke <jrtc27@freebsd.org>= wrote:
> A conditional assignment of the same value that has already been
> assigned unconditionally is unidiomatic code generally regarded as a > code smell and should be avoided. In an ideal world that would give a<= br>
I agree.

I've been bitten by __unused recently when porting stuff to linux
so was looking to avoid that.

--00000000000030d3d505ff5fd3a6--