From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.24; helo=mga09.intel.com; envelope-from=qin.long@intel.com; receiver=edk2-devel@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 A80E1202E61B9 for ; Tue, 17 Oct 2017 01:49:52 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Oct 2017 01:53:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,389,1503385200"; d="scan'208,217";a="910658237" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by FMSMGA003.fm.intel.com with ESMTP; 17 Oct 2017 01:53:27 -0700 Received: from fmsmsx152.amr.corp.intel.com (10.18.125.5) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 17 Oct 2017 01:53:27 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX152.amr.corp.intel.com (10.18.125.5) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 17 Oct 2017 01:53:26 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.218]) with mapi id 14.03.0319.002; Tue, 17 Oct 2017 16:53:25 +0800 From: "Long, Qin" To: Gary Lin , "Zhang, Chao B" CC: "edk2-devel@lists.01.org" Thread-Topic: [edk2] [PATCH] SecurityPkg:AuthVariableLib:Fix GCC build error Thread-Index: AQHTRu0y+QAUN/p5C0G821Tqc/7QIaLnvLoQ Date: Tue, 17 Oct 2017 08:53:24 +0000 Message-ID: References: <20171016140829.59124-1-chao.b.zhang@intel.com> <20171017021000.jen67cir7wrqpxfj@GaryWorkstation> In-Reply-To: <20171017021000.jen67cir7wrqpxfj@GaryWorkstation> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 Subject: Re: [PATCH] SecurityPkg:AuthVariableLib:Fix GCC build error 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: Tue, 17 Oct 2017 08:49:52 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Agree. It's better to use CHAR8 directly. From: Gary Lin [mailto:glin@suse.com] Sent: Tuesday, October 17, 2017 10:10 AM To: Zhang, Chao B Cc: edk2-devel@lists.01.org; Long, Qin Subject: Re: [edk2] [PATCH] SecurityPkg:AuthVariableLib:Fix GCC build error On Mon, Oct 16, 2017 at 10:08:29PM +0800, Zhang, Chao B wrote: > Fix GCC build error > > Cc: Long Qin > > Cc: Gary Lin > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Chao Zhang > > --- > SecurityPkg/Library/AuthVariableLib/AuthService.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/SecurityPkg/Library/AuthVariableLib/AuthService.c b/Security= Pkg/Library/AuthVariableLib/AuthService.c > index 7188ff6..1e7872a 100644 > --- a/SecurityPkg/Library/AuthVariableLib/AuthService.c > +++ b/SecurityPkg/Library/AuthVariableLib/AuthService.c > @@ -1564,7 +1564,7 @@ CalculatePrivAuthVarSignChainSHA256Digest( > // > // Get SignerCert CommonName > // > - Status =3D X509GetCommonName(SignerCert, SignerCertSize, CertCommonNam= e, &CertCommonNameSize); > + Status =3D X509GetCommonName(SignerCert, SignerCertSize, (CHAR8 *)Cert= CommonName, &CertCommonNameSize); Hi Chao Zhang, Although casting also silences the warning, why not declare CertCommonName as CHAR8 directly? The only signedness check happens in X509GetCommonName(). Sha256Update() requests "VOID *" so the signedness doesn't matter. Besides, AsciiStrLen() also requests CHAR8, so declaring CertCommonName as CHAR8 can remove the casting altogether. What do you think? Gary Lin > if (EFI_ERROR(Status)) { > DEBUG((DEBUG_INFO, "%a Get SignerCert CommonName failed with status = %x\n", __FUNCTION__, Status)); > return EFI_ABORTED; > -- > 1.9.5.msysgit.1 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel >