Skip to content

Commit

Permalink
ARM: bcm2835: Fix integer overflow in rpi_firmware_print_firmware_rev…
Browse files Browse the repository at this point in the history
…ision()

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
4a60f58 ("ARM: bcm2835: Switch to use %ptT"). Use temporary variable
of time64_t type to correctly handle lesser types.

Fixes: 4a60f58 ("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]>
Revieved-by: Petr Mladek <[email protected]>
Tested-by: Nicolas Saenz Julienne <[email protected]>
Signed-off-by: Nicolas Saenz Julienne <[email protected]>
Cc: Petr Mladek <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: Sergey Senozhatsky <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
andy-shev authored and Nicolas Saenz Julienne committed Jun 17, 2020
1 parent b3a9e3b commit da785a8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/firmware/raspberrypi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down

0 comments on commit da785a8

Please sign in to comment.