Hi David, Good point. I agree the change for 'time' should be standalone commit.
This change is to avoid the potential system hang caused by the NULL 'time' parameter usage. Thanks. Jiaxin > -----Original Message----- > From: David Woodhouse [mailto:dw...@infradead.org] > Sent: Thursday, March 10, 2016 6:39 PM > To: Wu, Jiaxin <jiaxin...@intel.com>; edk2-de...@ml01.01.org > Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Long, > Qin <qin.l...@intel.com> > Subject: Re: [edk2] [Patch 2/6] CryptoPkg: Add OpensslTlsLib module to > enable 'openssl\ssl' > > On Wed, 2016-02-24 at 16:15 +0800, Jiaxin Wu wrote: > > > > diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c > b/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c > > index 6422d61..93e487d 100644 > > --- a/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c > > +++ b/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c > > @@ -1,10 +1,10 @@ > > /** @file > > C Run-Time Libraries (CRT) Time Management Routines Wrapper > Implementation > > for OpenSSL-based Cryptographic Library (used in DXE & RUNTIME). > > > > -Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved. > > +Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved. > > This program and the accompanying materials > > are licensed and made available under the terms and conditions of the BSD > License > > which accompanies this distribution. The full text of the license may be > found at > > http://opensource.org/licenses/bsd-license.php > > > > @@ -71,10 +71,11 @@ UINTN CumulativeDays[2][14] = { > > // INTN *timer > > // ) > > time_t time (time_t *timer) > > { > > EFI_TIME Time; > > + time_t CalTime; > > UINTN Year; > > > > // > > // Get the current time and date information > > // > > @@ -82,26 +83,30 @@ time_t time (time_t *timer) > > > > // > > // Years Handling > > // UTime should now be set to 00:00:00 on Jan 1 of the current year. > > // > > - for (Year = 1970, *timer = 0; Year != Time.Year; Year++) { > > - *timer = *timer + (time_t)(CumulativeDays[IsLeap(Year)][13] * > SECSPERDAY); > > + for (Year = 1970, CalTime = 0; Year != Time.Year; Year++) { > > + CalTime = CalTime + (time_t)(CumulativeDays[IsLeap(Year)][13] * > SECSPERDAY); > > } > > > > // > > // Add in number of seconds for current Month, Day, Hour, Minute, > Seconds, and TimeZone adjustment > > // > > - *timer = *timer + > > - (time_t)((Time.TimeZone != EFI_UNSPECIFIED_TIMEZONE) ? > (Time.TimeZone * 60) : 0) + > > - (time_t)(CumulativeDays[IsLeap(Time.Year)][Time.Month] * > SECSPERDAY) + > > - (time_t)(((Time.Day > 0) ? Time.Day - 1 : 0) * SECSPERDAY) + > > - (time_t)(Time.Hour * SECSPERHOUR) + > > - (time_t)(Time.Minute * 60) + > > - (time_t)Time.Second; > > - > > - return *timer; > > + CalTime = CalTime + > > + (time_t)((Time.TimeZone != EFI_UNSPECIFIED_TIMEZONE) ? > (Time.TimeZone * 60) : 0) + > > + (time_t)(CumulativeDays[IsLeap(Time.Year)][Time.Month] * > SECSPERDAY) + > > + (time_t)(((Time.Day > 0) ? Time.Day - 1 : 0) * SECSPERDAY) + > > + (time_t)(Time.Hour * SECSPERHOUR) + > > + (time_t)(Time.Minute * 60) + > > + (time_t)Time.Second; > > + > > + if (timer != NULL) { > > + *timer = CalTime; > > + } > > + > > + return CalTime; > > } > > > > // > > // Convert a time value from type time_t to struct tm. > > // > > It looks like this should be a single standalone commit, with its own > commit comment explaining the change. > > -- > David Woodhouse Open Source Technology Centre > david.woodho...@intel.com Intel Corporation _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel