linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] ARM: bcm2835: Fix integer overflow in rpi_firmware_print_firmware_revision()
@ 2020-06-16 16:31 Andy Shevchenko
  2020-06-16 16:42 ` Nicolas Saenz Julienne
  2020-06-17 11:14 ` Nicolas Saenz Julienne
  0 siblings, 2 replies; 5+ messages in thread
From: Andy Shevchenko @ 2020-06-16 16:31 UTC (permalink / raw)
  To: linux-kernel, Arnd Bergmann
  Cc: Andy Shevchenko, Stefan Wahren, Nicolas Saenz Julienne,
	Petr Mladek, Steven Rostedt, Sergey Senozhatsky

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.

Fixes: 4a60f58ee002 ("ARM: bcm2835: Switch to use %ptT")
Reported-by: Stefan Wahren <wahrenst@gmx.net>
Reported-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
---
 drivers/firmware/raspberrypi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c
index ef8098856a47..625c8fdceabf 100644
--- a/drivers/firmware/raspberrypi.c
+++ b/drivers/firmware/raspberrypi.c
@@ -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
-- 
2.27.0.rc2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] ARM: bcm2835: Fix integer overflow in rpi_firmware_print_firmware_revision()
  2020-06-16 16:31 [PATCH v1] ARM: bcm2835: Fix integer overflow in rpi_firmware_print_firmware_revision() Andy Shevchenko
@ 2020-06-16 16:42 ` Nicolas Saenz Julienne
  2020-06-17  1:08   ` Sergey Senozhatsky
  2020-06-17  6:46   ` Petr Mladek
  2020-06-17 11:14 ` Nicolas Saenz Julienne
  1 sibling, 2 replies; 5+ messages in thread
From: Nicolas Saenz Julienne @ 2020-06-16 16:42 UTC (permalink / raw)
  To: Andy Shevchenko, linux-kernel, Arnd Bergmann
  Cc: Stefan Wahren, Petr Mladek, Steven Rostedt, Sergey Senozhatsky

[-- Attachment #1: Type: text/plain, Size: 1050 bytes --]

On Tue, 2020-06-16 at 19:31 +0300, Andy Shevchenko wrote:
> 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.
> 
> Fixes: 4a60f58ee002 ("ARM: bcm2835: Switch to use %ptT")
> Reported-by: Stefan Wahren <wahrenst@gmx.net>
> Reported-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Petr Mladek <pmladek@suse.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> ---

Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Tested-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

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


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] ARM: bcm2835: Fix integer overflow in rpi_firmware_print_firmware_revision()
  2020-06-16 16:42 ` Nicolas Saenz Julienne
@ 2020-06-17  1:08   ` Sergey Senozhatsky
  2020-06-17  6:46   ` Petr Mladek
  1 sibling, 0 replies; 5+ messages in thread
From: Sergey Senozhatsky @ 2020-06-17  1:08 UTC (permalink / raw)
  To: Nicolas Saenz Julienne
  Cc: Andy Shevchenko, linux-kernel, Arnd Bergmann, Stefan Wahren,
	Petr Mladek, Steven Rostedt, Sergey Senozhatsky

On (20/06/16 18:42), Nicolas Saenz Julienne wrote:
> On Tue, 2020-06-16 at 19:31 +0300, Andy Shevchenko wrote:
> > 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.
> > 
> > Fixes: 4a60f58ee002 ("ARM: bcm2835: Switch to use %ptT")
[..]
>
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] ARM: bcm2835: Fix integer overflow in rpi_firmware_print_firmware_revision()
  2020-06-16 16:42 ` Nicolas Saenz Julienne
  2020-06-17  1:08   ` Sergey Senozhatsky
@ 2020-06-17  6:46   ` Petr Mladek
  1 sibling, 0 replies; 5+ messages in thread
From: Petr Mladek @ 2020-06-17  6:46 UTC (permalink / raw)
  To: Nicolas Saenz Julienne
  Cc: Andy Shevchenko, linux-kernel, Arnd Bergmann, Stefan Wahren,
	Steven Rostedt, Sergey Senozhatsky

On Tue 2020-06-16 18:42:00, Nicolas Saenz Julienne wrote:
> On Tue, 2020-06-16 at 19:31 +0300, Andy Shevchenko wrote:
> > 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.
> > 
> > Fixes: 4a60f58ee002 ("ARM: bcm2835: Switch to use %ptT")
> > Reported-by: Stefan Wahren <wahrenst@gmx.net>
> > Reported-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > Cc: Petr Mladek <pmladek@suse.com>
> > Cc: Steven Rostedt <rostedt@goodmis.org>
> > Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> > ---
> 
> Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
> Tested-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

Revieved-by: Petr Mladek <pmladek@suse.com>

> 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.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] ARM: bcm2835: Fix integer overflow in rpi_firmware_print_firmware_revision()
  2020-06-16 16:31 [PATCH v1] ARM: bcm2835: Fix integer overflow in rpi_firmware_print_firmware_revision() Andy Shevchenko
  2020-06-16 16:42 ` Nicolas Saenz Julienne
@ 2020-06-17 11:14 ` Nicolas Saenz Julienne
  1 sibling, 0 replies; 5+ messages in thread
From: Nicolas Saenz Julienne @ 2020-06-17 11:14 UTC (permalink / raw)
  To: Andy Shevchenko, linux-kernel, Arnd Bergmann
  Cc: Stefan Wahren, Petr Mladek, Steven Rostedt, Sergey Senozhatsky

[-- Attachment #1: Type: text/plain, Size: 786 bytes --]

On Tue, 2020-06-16 at 19:31 +0300, Andy Shevchenko wrote:
> 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.
> 
> Fixes: 4a60f58ee002 ("ARM: bcm2835: Switch to use %ptT")
> Reported-by: Stefan Wahren <wahrenst@gmx.net>
> Reported-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Petr Mladek <pmladek@suse.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> ---

Applied to fixes branch,

Thanks,
Nicolas


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-06-17 11:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-16 16:31 [PATCH v1] ARM: bcm2835: Fix integer overflow in rpi_firmware_print_firmware_revision() Andy Shevchenko
2020-06-16 16:42 ` Nicolas Saenz Julienne
2020-06-17  1:08   ` Sergey Senozhatsky
2020-06-17  6:46   ` Petr Mladek
2020-06-17 11:14 ` Nicolas Saenz Julienne

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).