firmware: raspberrypi: print time using time64_t
PATCH 1/1 firmware: raspberrypi: print time using time64_t
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.
--- drivers/firmware/raspberrypi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/raspberrypi.c +1 -1
@@ -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",
Signature · 1 line
2.9.0
Quoted 9 lines · Arnd Bergmann
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_tand changes the deprecatedtime_to_tm()over totime64_to_tm()accordingly.There is still an overflow in y2106, but that is a limitation of the firmware interface, not a kernel problem.
I'll pull this in our branches.