Skip to content

Commit

Permalink
[IA64] Wrong args to memset in efi_gettimeofday()
Browse files Browse the repository at this point in the history
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: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
  • Loading branch information
Li Zefan authored and Tony Luck committed Nov 6, 2007
1 parent 8d0a6e4 commit 4b07ae9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arch/ia64/kernel/efi.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,10 @@ efi_gettimeofday (struct timespec *ts)
{
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;
}

ts->tv_sec = mktime(tm.year, tm.month, tm.day, tm.hour, tm.minute, tm.second);
ts->tv_nsec = tm.nanosecond;
Expand Down

0 comments on commit 4b07ae9

Please sign in to comment.