From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb0-x22a.google.com (mail-yb0-x22a.google.com [IPv6:2607:f8b0:4002:c09::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C37411A1E3A for ; Mon, 24 Oct 2016 01:00:48 -0700 (PDT) Received: by mail-yb0-x22a.google.com with SMTP id g68so69180415ybi.0 for ; Mon, 24 Oct 2016 01:00:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ypgV1G7xu6e28tnA5hPmncsu6R5p/i65DEsIYiUnzoA=; b=dzdm17B/DGON1a3W7FQIBVQs91zTr2FDldOxSLEuSSBS+zJd4+3H88zm/3Tx/OcoNz ynm+zX/GwJ3duKpcapZTaIgMIIjnEYuedtAdz1ZVMlj+ttz/Vfygk0LiShXoOPOhcLzf SaRq/KVW6K36IDgCUWjnSyfpmBl8ni4wCZHvQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ypgV1G7xu6e28tnA5hPmncsu6R5p/i65DEsIYiUnzoA=; b=OBG31ybhN5Fr9RDPZLe4+A8EI7ZOb/IA/EfUO4nDq8yDL8oaLwIJsGJPH25d/QO8IM e0BgErxeOEwK+iJcjGVSzre4siZXK9dwOBNBpCwsheos8L0lWWdvJYVfeUfop9iK/Wsa hvySEynxTwcUPoJ9W01787NMIu1MMZSFaiNqrafq072OB8KucZKgE7HnZMe6JIK9YRJP 3eKZKzJj41HzKZ6Ijowv9/kxvhLsC5IFm1GiBngeJ1dGrAyM9NMCY0QLQnLL+2dcGBc7 hFteO/96YOb/hJAXu/fJrf1fMNSY3ry7jwU2tu5BXq+6eTKapvCk9IhM6B5fotY+ZFWA e95A== X-Gm-Message-State: ABUngvd1/T46KJLOQFZGv2QXoS5Oba4SP1xzg5Wh4wW+1rESP4k1fAFH8N6U8zMISkyGFX8Fo3fMIdwgBFt+jWCX X-Received: by 10.36.83.80 with SMTP id n77mr1182132itb.63.1477296048004; Mon, 24 Oct 2016 01:00:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.5.139 with HTTP; Mon, 24 Oct 2016 01:00:47 -0700 (PDT) In-Reply-To: <20161021212737.15974-7-lersek@redhat.com> References: <20161021212737.15974-1-lersek@redhat.com> <20161021212737.15974-7-lersek@redhat.com> From: Ard Biesheuvel Date: Mon, 24 Oct 2016 09:00:47 +0100 Message-ID: To: Laszlo Ersek Cc: edk2-devel-01 , Jordan Justen Subject: Re: [PATCH 06/19] OvmfPkg/SmbiosVersionLib: eliminate unchecked PcdSetXX() calls X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Oct 2016 08:00:49 -0000 Content-Type: text/plain; charset=UTF-8 On 21 October 2016 at 22:27, Laszlo Ersek wrote: > These are deprecated / disabled under the > DISABLE_NEW_DEPRECATED_INTERFACES feature test macro. > > Introduce a variable called PcdStatus, and use it to assert the success of > these operations (there is no reason for them to fail here). > > Cc: Ard Biesheuvel > Cc: Jordan Justen > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=166 > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Laszlo Ersek Reviewed-by: Ard Biesheuvel > --- > > Notes: > tested with OVMF (smbios v2) and ArmVirtQemu (smbios v3) > > OvmfPkg/Library/SmbiosVersionLib/DetectSmbiosVersionLib.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/OvmfPkg/Library/SmbiosVersionLib/DetectSmbiosVersionLib.c b/OvmfPkg/Library/SmbiosVersionLib/DetectSmbiosVersionLib.c > index 950c3f7e0a31..58180412bd1a 100644 > --- a/OvmfPkg/Library/SmbiosVersionLib/DetectSmbiosVersionLib.c > +++ b/OvmfPkg/Library/SmbiosVersionLib/DetectSmbiosVersionLib.c > @@ -40,6 +40,7 @@ DetectSmbiosVersion ( > UINTN AnchorSize, TablesSize; > QEMU_SMBIOS_ANCHOR QemuAnchor; > UINT16 SmbiosVersion; > + RETURN_STATUS PcdStatus; > > if (PcdGetBool (PcdQemuSmbiosValidated)) { > // > @@ -87,7 +88,8 @@ DetectSmbiosVersion ( > > DEBUG ((EFI_D_INFO, "%a: SMBIOS 3.x DocRev from QEMU: 0x%02x\n", > __FUNCTION__, QemuAnchor.V3.DocRev)); > - PcdSet8 (PcdSmbiosDocRev, QemuAnchor.V3.DocRev); > + PcdStatus = PcdSet8S (PcdSmbiosDocRev, QemuAnchor.V3.DocRev); > + ASSERT_RETURN_ERROR (PcdStatus); > break; > > default: > @@ -96,12 +98,14 @@ DetectSmbiosVersion ( > > DEBUG ((EFI_D_INFO, "%a: SMBIOS version from QEMU: 0x%04x\n", __FUNCTION__, > SmbiosVersion)); > - PcdSet16 (PcdSmbiosVersion, SmbiosVersion); > + PcdStatus = PcdSet16S (PcdSmbiosVersion, SmbiosVersion); > + ASSERT_RETURN_ERROR (PcdStatus); > > // > // SMBIOS platform drivers can now fetch and install > // "etc/smbios/smbios-tables" from QEMU. > // > - PcdSetBool (PcdQemuSmbiosValidated, TRUE); > + PcdStatus = PcdSetBoolS (PcdQemuSmbiosValidated, TRUE); > + ASSERT_RETURN_ERROR (PcdStatus); > return RETURN_SUCCESS; > } > -- > 2.9.2 > >