From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.81]) by mx.groups.io with SMTP id smtpd.web11.26035.1574352989721209937 for ; Thu, 21 Nov 2019 08:16:29 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TnUWUFeb; spf=pass (domain: redhat.com, ip: 207.211.31.81, mailfrom: philmd@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574352988; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EogvjM34eloeyF19zi5Qro/oOirKkCdHdWjWQPUoaw0=; b=TnUWUFeb3lNpvMAjHP6HRdp8V7LFGcKg4pDyOPl+zDoQJHV6gsddBokrYmjTFWd4maamTL EeDJZ6Qwd0ORS73GpempOTMfCeTplrLNIgvO11IvPHm0Q5ZdCGGOJzHmPaHQ3CpEtafFgF 4tCzChjwrgcqiN8BBjgAoq56Z42sTmE= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-265-G5mDO35rOXGCY3jVmfuIPg-1; Thu, 21 Nov 2019 11:16:22 -0500 Received: by mail-wr1-f72.google.com with SMTP id q6so2338352wrv.11 for ; Thu, 21 Nov 2019 08:16:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=g0hzyXeaxwHbyRIxNL0aolxrJr94SW9RxGqGAEXBiEw=; b=E+AQu0LiBwdd6lIycwBpcd296tiv8GFdRgU3Dfj71BMcWS4IBc14QUH9fTJXzWkPxc xpBT9jsWTKo4vw3sVv+sI906lMyrwMg6u5eZkLTogw/BSp2ln2o+kGOivU6HxD4gE66D 4MInfZ72nWf3d3bm2d+pm32rgka/z8i71dX1EJjFyXcTEz82f8gAOwYdoS2PsYpcYITN zPbZIISux2UmqC/qvXxw61ry3j2EpKIkDOfnB8kN0Bi0zn1jXeOXnh0OMN7DzWbcTvXz fbQGIqL/WMZgfqr9GdBTIUXOrsL+NilChOKsUxR389sdLVichBX/V8RhhMBXZ7noUUdB TAfw== X-Gm-Message-State: APjAAAVjGdqyvXraYk0oGN3YNUseZ2XvAeN2APpky1fJiCqBI+ndfghu n+v2vFlIFGh7674Cu1Czcv2D+Q9x+jfw6jT4SbdkyIZ/XJbbZMyAG+rloXdgnylcSZWhED6u58u lPKSZziY1/ZaOdg== X-Received: by 2002:a1c:e08a:: with SMTP id x132mr11075160wmg.146.1574352981318; Thu, 21 Nov 2019 08:16:21 -0800 (PST) X-Google-Smtp-Source: APXvYqyFm6rD075TKrUcZpEB9mTNyQ0VfReYUAKrSL73Ahkdg+oMMtQ5vjgKzbrjyBEc7Db4UgIsmg== X-Received: by 2002:a1c:e08a:: with SMTP id x132mr11075120wmg.146.1574352981079; Thu, 21 Nov 2019 08:16:21 -0800 (PST) Return-Path: Received: from [192.168.1.35] (131.red-88-21-102.staticip.rima-tde.net. [88.21.102.131]) by smtp.gmail.com with ESMTPSA id z2sm3941007wrs.89.2019.11.21.08.16.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 Nov 2019 08:16:20 -0800 (PST) Subject: Re: [edk2-devel] [PATCH V1 1/1] MdeModulePkg/Variable: Initialize local variable To: devel@edk2.groups.io, michael.a.kubacki@intel.com Cc: Liming Gao , Michael D Kinney , Jian J Wang , Hao A Wu References: <20191121023256.24820-1-michael.a.kubacki@intel.com> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Message-ID: Date: Thu, 21 Nov 2019 17:16:19 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <20191121023256.24820-1-michael.a.kubacki@intel.com> X-MC-Unique: G5mDO35rOXGCY3jVmfuIPg-1 X-Mimecast-Spam-Score: 0 Content-Language: en-US Content-Type: text/plain; charset=WINDOWS-1252; format=flowed Content-Transfer-Encoding: quoted-printable Hi Michael, On 11/21/19 3:32 AM, Kubacki, Michael A wrote: > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2364 >=20 > Fixes a new build warning in VS2012 introduced in f8ff4cca7c. >=20 > This patch initializes the local variable "Variable" in > VariableServiceGetNextVariableInternal () and the local > variable "RtPtrTrack" in FindVariableInRuntimeCache (). > This enusres the pointers in the structures are initialized Typo "this ensures" > in the case no variable stores exist in the list of variable > stores. >=20 > Cc: Liming Gao > Cc: Michael D Kinney > Cc: Jian J Wang > Cc: Hao A Wu > Signed-off-by: Michael Kubacki > --- > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.c | 2 = ++ > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c | 2 = ++ > 2 files changed, 4 insertions(+) >=20 > diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.c= b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.c > index d458f1c608..f6d187543d 100644 > --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.c > +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.c > @@ -551,6 +551,8 @@ VariableServiceGetNextVariableInternal ( > return EFI_INVALID_PARAMETER; > } > =20 > + ZeroMem (&Variable, sizeof (Variable)); > + I agree with this change. > // Check if the variable exists in the given variable store list > for (StoreType =3D (VARIABLE_STORE_TYPE) 0; StoreType < VariableStore= TypeMax; StoreType++) { > if (VariableStoreList[StoreType] =3D=3D NULL) { > diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntim= eDxe.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c > index d525998ae3..2cf0ed32ae 100644 > --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c > +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c > @@ -590,6 +590,8 @@ FindVariableInRuntimeCache ( > return EFI_INVALID_PARAMETER; > } > =20 > + ZeroMem (&RtPtrTrack, sizeof (RtPtrTrack)); > + > // > // The UEFI specification restricts Runtime Services callers from inv= oking the same or certain other Runtime Service > // functions prior to completion and return from a previous Runtime S= ervice call. These restrictions prevent >=20 Here this seems overkill, what about: -- >8 -- --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c @@ -626,6 +626,10 @@ FindVariableInRuntimeCache ( } } + if (RtPtrTrack.CurrPtr) { + goto Done; + } + if (!EFI_ERROR (Status)) { // // Get data size --- Can you split this patch in 2? If so you can add to the 1st part: Reviewed-by: Philippe Mathieu-Daude