* [PATCH] firmware: raspberrypi: print time using time64_t
@ 2017-11-27 11:57 Arnd Bergmann
2017-11-27 16:20 ` Eric Anholt
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2017-11-27 11:57 UTC (permalink / raw)
To: Eric Anholt
Cc: y2038, Stefan Wahren, linux-rpi-kernel, Arnd Bergmann, linux-kernel
The firmware timestamp is an unsigned 32-bit value, but we copy it into
a signed 32-bit variable, so we can theoretically get an overflow in
the calculation when the timestamp is between 2038 and 2106.
This changes the temporary variable to time64_t and changes the deprecated
time_to_tm() over to time64_to_tm() accordingly.
There is still an overflow in y2106, but that is a limitation of the
firmware interface, not a kernel problem.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/firmware/raspberrypi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c
index dd506cd3a5b8..6692888f04cf 100644
--- a/drivers/firmware/raspberrypi.c
+++ b/drivers/firmware/raspberrypi.c
@@ -174,7 +174,7 @@ rpi_firmware_print_firmware_revision(struct rpi_firmware *fw)
if (ret == 0) {
struct tm tm;
- time_to_tm(packet, 0, &tm);
+ time64_to_tm(packet, 0, &tm);
dev_info(fw->cl.dev,
"Attached to firmware from %04ld-%02d-%02d %02d:%02d\n",
--
2.9.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] firmware: raspberrypi: print time using time64_t
2017-11-27 11:57 [PATCH] firmware: raspberrypi: print time using time64_t Arnd Bergmann
@ 2017-11-27 16:20 ` Eric Anholt
0 siblings, 0 replies; 2+ messages in thread
From: Eric Anholt @ 2017-11-27 16:20 UTC (permalink / raw)
To: Arnd Bergmann
Cc: y2038, Stefan Wahren, linux-rpi-kernel, Arnd Bergmann, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 571 bytes --]
Arnd Bergmann <arnd@arndb.de> writes:
> The firmware timestamp is an unsigned 32-bit value, but we copy it into
> a signed 32-bit variable, so we can theoretically get an overflow in
> the calculation when the timestamp is between 2038 and 2106.
>
> This changes the temporary variable to time64_t and changes the deprecated
> time_to_tm() over to time64_to_tm() accordingly.
>
> There is still an overflow in y2106, but that is a limitation of the
> firmware interface, not a kernel problem.
Reviewed-by: Eric Anholt <eric@anholt.net>
I'll pull this in our branches.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-11-27 16:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-27 11:57 [PATCH] firmware: raspberrypi: print time using time64_t Arnd Bergmann
2017-11-27 16:20 ` Eric Anholt
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.