From: Li Zefan Date: Tue, 6 Nov 2007 21:40:39 +0000 (-0800) Subject: [IA64] Wrong args to memset in efi_gettimeofday() X-Git-Tag: v2.6.24-rc3~169^2~9 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b07ae9b9d7b05a63e3ece32a666041949b7f421;p=linux-2.6 [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: Li Zefan Signed-off-by: Tony Luck --- diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c index 6216eba2e3..5181bf551f 100644 --- a/arch/ia64/kernel/efi.c +++ b/arch/ia64/kernel/efi.c @@ -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;