From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=pjones@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 04C472034C0BC for ; Fri, 20 Oct 2017 11:18:11 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 752A613AB0; Fri, 20 Oct 2017 18:21:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 752A613AB0 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=pjones@redhat.com Received: from redhat.com (dhcp-10-20-1-221.bss.redhat.com [10.20.1.221]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C60495D9CA; Fri, 20 Oct 2017 18:21:49 +0000 (UTC) Date: Fri, 20 Oct 2017 14:21:47 -0400 From: Peter Jones To: Laszlo Ersek Cc: edk2-devel@lists.01.org, "Shi, Steven" , Qin Long , Ting Ye Message-ID: <20171020182147.4rsisbduvvjweb2z@redhat.com> References: <20171020151018.785-1-pjones@redhat.com> <0a2c301c-58a8-ecf7-8d1a-40dd5ab8bc8e@redhat.com> MIME-Version: 1.0 In-Reply-To: <0a2c301c-58a8-ecf7-8d1a-40dd5ab8bc8e@redhat.com> User-Agent: NeoMutt/20171013 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 20 Oct 2017 18:21:50 +0000 (UTC) Subject: Re: [PATCH v1 1/1] CryptoPkg/BaseCryptLib: remove some duplicate initializations. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Oct 2017 18:18:12 -0000 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline > Assuming the maintainers are fine with the patch as well, I suggest that > they please replace the word "initializations" with "assignments" in the > subject, to be pedantic on the C-lang level. Well, that's why I said "initializations" instead of "initializers", but if it's more clear to you, I'm fine with your way. > (Side note: I would even move OldSize to a lot tighter scope: > > > diff --git a/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7Verify.c b/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7Verify.c > > index d564591cb7f9..31a9ecd59ff6 100644 > > --- a/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7Verify.c > > +++ b/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7Verify.c > > @@ -477,7 +477,6 @@ Pkcs7GetCertificatesList ( > > UINT8 *CertBuf; > > UINT8 *OldBuf; > > UINTN BufferSize; > > - UINTN OldSize; > > UINT8 *SingleCert; > > UINTN CertSize; > > > > @@ -612,10 +611,11 @@ Pkcs7GetCertificatesList ( > > > > if (CtxChain != NULL) { > > BufferSize = sizeof (UINT8); > > - OldSize = BufferSize; > > CertBuf = NULL; > > > > for (Index = 0; ; Index++) { > > + UINTN OldSize; > > + > > Status = X509PopCertificate (CtxChain, &SingleCert, &CertSize); > > if (!Status) { > > break; > > @@ -656,10 +656,11 @@ Pkcs7GetCertificatesList ( > > > > if (CtxUntrusted != NULL) { > > BufferSize = sizeof (UINT8); > > - OldSize = BufferSize; > > CertBuf = NULL; > > > > for (Index = 0; ; Index++) { > > + UINTN OldSize; > > + > > Status = X509PopCertificate (CtxUntrusted, &SingleCert, &CertSize); > > if (!Status) { > > break; > > However, many edk2 maintainers don't like tight scoping like this.) I had considered this and guessed it was probably against the coding style or it would have been done this way already. IMO it's better in every way. -- Peter