From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0729.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe42::729]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6381181F6F for ; Thu, 8 Dec 2016 16:26:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=E4NdFvOMzS2OQJH17/P5nfFvSyaVFP7LQjISreeo6K0=; b=iVa38TLwWbT/qyY3Ho0GgtonHXC+4NDeNrt2ehlJor/b2klYAC0bJyaHJli3ihS25R9KnlQo91qklzBTkQCMq+f4THfDmc9N5f9F/rusg5netPaF/mAOJF7APZJRsnbmHMoAYf1ihNOnvoK2H2Oa2Fz1bzCiYE0SOt8IHlC3K3Y= Received: from SN2PR03MB2351.namprd03.prod.outlook.com (10.166.210.142) by SN2PR03MB2350.namprd03.prod.outlook.com (10.166.210.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.761.9; Fri, 9 Dec 2016 00:26:36 +0000 Received: from SN2PR03MB2351.namprd03.prod.outlook.com ([10.166.210.142]) by SN2PR03MB2351.namprd03.prod.outlook.com ([10.166.210.142]) with mapi id 15.01.0761.018; Fri, 9 Dec 2016 00:26:36 +0000 From: Kurt Kennett To: "Yao, Jiewen" , "Bi, Dandan" , "edk2-devel@lists.01.org" CC: "Ni, Ruiyu" Thread-Topic: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration Thread-Index: AQHSUUGEv7dYXu5p+0mZLsjiSWUaf6D+TfQwgABqC0CAAArK4A== Date: Fri, 9 Dec 2016 00:26:35 +0000 Message-ID: References: <1481194467-75920-1-git-send-email-dandan.bi@intel.com> <1481194467-75920-3-git-send-email-dandan.bi@intel.com> <74D8A39837DF1E4DA445A8C0B3885C50386F23F1@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <74D8A39837DF1E4DA445A8C0B3885C50386F23F1@SHSMSX104.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Kurt.Kennett@microsoft.com; x-originating-ip: [2001:4898:80e8::d5] x-ms-office365-filtering-correlation-id: 8ae8d024-b232-437f-8db7-08d41fca08fc x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:SN2PR03MB2350; x-microsoft-exchange-diagnostics: 1; SN2PR03MB2350; 7:zUCh+GdmJIhkCmyI+CnKmByBnvl/9N5yAPKBB3ja/d2CFfqpXjNYdXd06loa+9lm5P/CZoYiqrH4cty6ftnvzM3T6rKzSG8NkcNrxtldrXAzdCf7wKgJJ4pwqnoUAwfGkDK7tYVJFp5AdBzPK/gYDEayOZyBSDnvE/XTUm9/v1/3Riy3+HshSOOb/ej5yAwiju+tuGSIRP0AQzhi4inRPmzSsOy0nT2kvdwCw1TgoalG/VQLKhdf6SgvPVAQg6tSxhx0S0/KO0c3zSQ25VsVvpF2uvyPmnnofLtGSoKqBMvZEBStEY6eqkH9dkUWEj4JqRGjyxgBpEGMDpl/EemVnij7/wkNkLRhoMVhhGjfj+/UXoP0H0rXH8bmjV3wtIwVIIDFhPoA0C+u2xDdLRf20M+MbtUFv+ubXKWczorde8mNpIJvEF1Qc+C1U3ZjcuudBXT7pMMDKIMJiptFdqqFbIlKU7J7+kgWyLOznqfLvWU= x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(162533806227266)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(61425038)(6040375)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026)(61426038)(61427038)(6041248)(20161123564025)(20161123562025)(20161123555025)(20161123560025)(6072148)(6047074); SRVR:SN2PR03MB2350; BCL:0; PCL:0; RULEID:; SRVR:SN2PR03MB2350; x-forefront-prvs: 015114592F x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(7916002)(39850400002)(39410400002)(39860400002)(39450400003)(39840400002)(199003)(189002)(13464003)(377454003)(7736002)(102836003)(3660700001)(10090500001)(10290500002)(3280700002)(4326007)(2906002)(6116002)(7696004)(5005710100001)(93886004)(2501003)(2950100002)(2900100001)(189998001)(92566002)(122556002)(5660300001)(33656002)(99286002)(105586002)(106116001)(106356001)(77096006)(68736007)(54356999)(6506006)(97736004)(86612001)(81156014)(8676002)(5001770100001)(101416001)(86362001)(74316002)(305945005)(50986999)(38730400001)(81166006)(8936002)(9686002)(229853002)(6436002)(8990500004)(76176999)(76576001); DIR:OUT; SFP:1102; SCL:1; SRVR:SN2PR03MB2350; H:SN2PR03MB2351.namprd03.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Dec 2016 00:26:35.9635 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR03MB2350 Subject: Re: [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration 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: Fri, 09 Dec 2016 00:26:40 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Is the data 'variable'? i.e does it ever change? A normal compiler should put this data into a section marked read-only if i= t is marked as const, and a loader could read-protect the region after load= . K2 -----Original Message----- From: Yao, Jiewen [mailto:jiewen.yao@intel.com]=20 Sent: Thursday, December 8, 2016 3:47 PM To: Kurt Kennett ; Bi, Dandan ; edk2-devel@lists.01.org Cc: Ni, Ruiyu Subject: RE: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable = after declaration Agree. Maybe we can move it to be a global variable ? Thank you Yao Jiewen > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of=20 > Kurt Kennett > Sent: Friday, December 9, 2016 1:28 AM > To: Bi, Dandan ; edk2-devel@lists.01.org > Cc: Ni, Ruiyu > Subject: Re: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize=20 > variable after declaration >=20 > This seems kind of silly. > Why isn't this just const data? This adds code and memory accesses=20 > that are worthless and happen on every call to the function. >=20 > K2 >=20 > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of=20 > Dandan Bi > Sent: Thursday, December 8, 2016 2:54 AM > To: edk2-devel@lists.01.org > Cc: Ruiyu Ni > Subject: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable=20 > after declaration >=20 > Cc: Ruiyu Ni > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Dandan Bi > --- > FatPkg/EnhancedFatDxe/Misc.c | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) >=20 > diff --git a/FatPkg/EnhancedFatDxe/Misc.c=20 > b/FatPkg/EnhancedFatDxe/Misc.c index f91759c..6ad688c 100644 > --- a/FatPkg/EnhancedFatDxe/Misc.c > +++ b/FatPkg/EnhancedFatDxe/Misc.c > @@ -696,15 +696,27 @@ Returns: > TRUE - The time is valid. > FALSE - The time is not valid. >=20 > --*/ > { > - static UINT8 MonthDays[] =3D { 31, 28, 31, 30, 31, 30, 31, 31, 30,=20 > 31, 30, 31 }; > + STATIC UINT8 MonthDays[12]; > UINTN Day; > BOOLEAN ValidTime; >=20 > ValidTime =3D TRUE; > + MonthDays[0] =3D 31; > + MonthDays[1] =3D 28; > + MonthDays[2] =3D 31; > + MonthDays[3] =3D 30; > + MonthDays[4] =3D 31; > + MonthDays[5] =3D 30; > + MonthDays[6] =3D 31; > + MonthDays[7] =3D 31; > + MonthDays[8] =3D 30; > + MonthDays[9] =3D 31; > + MonthDays[10] =3D 30; > + MonthDays[11] =3D 31; >=20 > // > // Check the fields for range problems > // Fat can only support from 1980 > // > -- > 1.9.5.msysgit.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel