ARM: bcm2835: Fix integer overflow in rpi_firmware_print_firmware_revision()
PATCH 1/1 ARM: bcm2835: Fix integer overflow in rpi_firmware_print_firmware_revision()
time64_t is 64-bit width type, we are not supposed to supply lesser ones as in the case of rpi_firmware_print_firmware_revision() after the commit 4a60f58ee002 ("ARM: bcm2835: Switch to use %ptT"). Use temporary variable of time64_t type to correctly handle lesser types.
--- drivers/firmware/raspberrypi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/firmware/raspberrypi.c +4 -1
@@ -181,6 +181,7 @@ EXPORT_SYMBOL_GPL(rpi_firmware_property);static void rpi_firmware_print_firmware_revision (struct rpi_firmware *fw) { +time64_t date_and_time;u32 packet; int ret = rpi_firmware_property(fw, RPI_FIRMWARE_GET_FIRMWARE_REVISION,
@@ -189,7 +190,9 @@ rpi_firmware_print_firmware_revision(struct rpi_firmware *fw)if (ret)return ; -dev_info (fw->cl.dev,"Attached to firmware from %ptT\n" , &packet); +/* This is not compatible with y2038 */ + date_and_time = packet; +dev_info (fw->cl.dev,"Attached to firmware from %ptT\n" , &date_and_time); } static void
Signature · 1 line
2.27.0.rc2
Quoted 5 lines · Andy Shevchenko
time64_tis 64-bit width type, we are not supposed to supply lesser ones as in the case ofrpi_firmware_print_firmware_revision()after the commit4a60f58ee002("ARM: bcm2835: Switch to use %ptT"). Use temporary variable oftime64_ttype to correctly handle lesser types.
Quoted 8 lines
Fixes 4a60f58ee002 ("ARM: bcm2835: Switch to use %ptT")Reported-by Stefan Wahren <[email protected]>Reported-by Nicolas Saenz Julienne <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>Cc Petr Mladek <[email protected]>Cc Steven Rostedt <[email protected]>Cc Sergey Senozhatsky <[email protected]>---
If this doesn't fit the printk tree I don't mind taking it trough the rpi soc tree.
I'll also update the MAINTAINERS file so the firmware driver isn't orphaned.
Thanks!
Nicolas
Quoted 7 lines · Nicolas Saenz Julienne
Quoted 6 lines · Andy Shevchenko
time64_tis 64-bit width type, we are not supposed to supply lesser ones as in the case ofrpi_firmware_print_firmware_revision()after the commit4a60f58ee002("ARM: bcm2835: Switch to use %ptT"). Use temporary variable oftime64_ttype to correctly handle lesser types.Fixes 4a60f58ee002 ("ARM: bcm2835: Switch to use %ptT")
[..]
Quoted 3 lines
If this doesn't fit the printk tree I don't mind taking it trough the rpi soc tree.
I think, for this patch, SoC tree might be a better fit than printk tree, thanks.
-ss
Quoted 15 lines · Nicolas Saenz Julienne
Quoted 5 lines · Andy Shevchenko
time64_tis 64-bit width type, we are not supposed to supply lesser ones as in the case ofrpi_firmware_print_firmware_revision()after the commit4a60f58ee002("ARM: bcm2835: Switch to use %ptT"). Use temporary variable oftime64_ttype to correctly handle lesser types.Quoted 8 lines
Fixes 4a60f58ee002 ("ARM: bcm2835: Switch to use %ptT")Reported-by Stefan Wahren <[email protected]>Reported-by Nicolas Saenz Julienne <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>Cc Petr Mladek <[email protected]>Cc Steven Rostedt <[email protected]>Cc Sergey Senozhatsky <[email protected]>---
Quoted 2 lines
Reviewed-by Nicolas Saenz Julienne <[email protected]>
Quoted 4 lines
If this doesn't fit the printk tree I don't mind taking it trough the rpi soc tree.
I'll also update the
MAINTAINERSfile so the firmware driver isn't orphaned.
I agree with Sergey that this should better go via SOC tree.
That said, feel free to ask to take it via printk tree. It has caused the regression after all ;-)
Best Regards,
Petr
Nicolas Saenz Julienne
AppliedQuoted 5 lines · Andy Shevchenko
time64_tis 64-bit width type, we are not supposed to supply lesser ones as in the case ofrpi_firmware_print_firmware_revision()after the commit4a60f58ee002("ARM: bcm2835: Switch to use %ptT"). Use temporary variable oftime64_ttype to correctly handle lesser types.
Quoted 8 lines
Fixes 4a60f58ee002 ("ARM: bcm2835: Switch to use %ptT")Reported-by Stefan Wahren <[email protected]>Reported-by Nicolas Saenz Julienne <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>Cc Petr Mladek <[email protected]>Cc Steven Rostedt <[email protected]>Cc Sergey Senozhatsky <[email protected]>---
Applied to fixes branch,
Thanks,
Nicolas