mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Matt Fleming <matt@codeblueprint.co.uk>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org
Cc: y2038@lists.linaro.org, Arnd Bergmann <arnd@arndb.de>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] x86: fix unused efi_get_time function
Date: Fri, 17 Jun 2016 16:51:29 +0200	[thread overview]
Message-ID: <20160617145152.3569706-1-arnd@arndb.de> (raw)

Nothing calls the efi_get_time function on x86, but it does suffer
from the 32-bit time_t overflow in 2038.

To avoid that if anyone starts calling it, this changes the function
to use timespec64 and mktime64 instead.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
The obvious alternative would be to remove the function, I'll send
that patch as well, so you can pick one or the other.

 arch/x86/platform/efi/efi.c | 6 +++---
 include/linux/efi.h         | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 56400d03409f..d72d5de02f61 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -97,7 +97,7 @@ static efi_status_t __init phys_efi_set_virtual_address_map(
 	return status;
 }
 
-void efi_get_time(struct timespec *now)
+void efi_get_time(struct timespec64 *now)
 {
 	efi_status_t status;
 	efi_time_t eft;
@@ -107,8 +107,8 @@ void efi_get_time(struct timespec *now)
 	if (status != EFI_SUCCESS)
 		pr_err("Oops: efitime: can't read time!\n");
 
-	now->tv_sec = mktime(eft.year, eft.month, eft.day, eft.hour,
-			     eft.minute, eft.second);
+	now->tv_sec = mktime64(eft.year, eft.month, eft.day, eft.hour,
+			       eft.minute, eft.second);
 	now->tv_nsec = 0;
 }
 
diff --git a/include/linux/efi.h b/include/linux/efi.h
index acb6adace01e..dca8810d6b49 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -975,7 +975,7 @@ extern u64 efi_mem_desc_end(efi_memory_desc_t *md);
 extern int efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *out_md);
 extern void efi_initialize_iomem_resources(struct resource *code_resource,
 		struct resource *data_resource, struct resource *bss_resource);
-extern void efi_get_time(struct timespec *now);
+extern void efi_get_time(struct timespec64 *now);
 extern void efi_reserve_boot_services(void);
 extern int efi_get_fdt_params(struct efi_fdt_params *params);
 extern struct kobject *efi_kobj;
-- 
2.9.0

             reply	other threads:[~2016-06-17 14:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-17 14:51 Arnd Bergmann [this message]
2016-06-23 13:32 ` Matt Fleming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160617145152.3569706-1-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=ard.biesheuvel@linaro.org \
    --cc=hpa@zytor.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@codeblueprint.co.uk \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=y2038@lists.linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®