Commit 4b07ae9b authored by Li Zefan's avatar Li Zefan Committed by Tony Luck

[IA64] Wrong args to memset in efi_gettimeofday()

Not sizeof(ptr) ... we meant to say sizeof(*ptr).

Also moved the memset to the error path (the normal path overwrites
every field in the structure anyway) -Tony
Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
parent 8d0a6e4d
...@@ -218,9 +218,10 @@ efi_gettimeofday (struct timespec *ts) ...@@ -218,9 +218,10 @@ efi_gettimeofday (struct timespec *ts)
{ {
efi_time_t tm; efi_time_t tm;
memset(ts, 0, sizeof(ts)); if ((*efi.get_time)(&tm, NULL) != EFI_SUCCESS) {
if ((*efi.get_time)(&tm, NULL) != EFI_SUCCESS) memset(ts, 0, sizeof(*ts));
return; return;
}
ts->tv_sec = mktime(tm.year, tm.month, tm.day, tm.hour, tm.minute, tm.second); ts->tv_sec = mktime(tm.year, tm.month, tm.day, tm.hour, tm.minute, tm.second);
ts->tv_nsec = tm.nanosecond; ts->tv_nsec = tm.nanosecond;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment