All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] serial: sh-sci: Initialise variables before access in sci_set_termios()
@ 2013-06-20 12:25 ` Simon Horman
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2013-06-20 12:25 UTC (permalink / raw)
  To: linux-arm-kernel

This change addresses two warnings that are flagged by gcc relating to
potential access to the ssr and cks variables while they are uninitialised.

I have addressed this by initialising the values to
the defaults present in sci_baud_calc_hscif().

It is my analysis that cks is always initialised if used
but that without this change ssr may be accessed while uninitialised.

The code altered by this patch was introduced by commit
f303b364b41d3fc5bf879799128958400b7859aa ("serial: sh-sci: HSCIF support").

Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 drivers/tty/serial/sh-sci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 931d6c3..7477e0e 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1887,9 +1887,9 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
 {
 	struct sci_port *s = to_sci_port(port);
 	struct plat_sci_reg *reg;
-	unsigned int baud, smr_val, max_baud, cks;
+	unsigned int baud, smr_val, max_baud, cks = 0;
 	int t = -1;
-	unsigned int srr;
+	unsigned int srr = 15;
 
 	/*
 	 * earlyprintk comes here early on with port->uartclk set to zero.
-- 
1.8.2.1


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

* [PATCH] serial: sh-sci: Initialise variables before access in sci_set_termios()
@ 2013-06-20 12:25 ` Simon Horman
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2013-06-20 12:25 UTC (permalink / raw)
  To: linux-sh, Arnd Bergmann
  Cc: Greg Kroah-Hartman, Jiri Slaby, Ulrich Hecht, Magnus Damm,
	Paul Mundt, Olof Johansson, linux-serial, linux-arm-kernel,
	Simon Horman

This change addresses two warnings that are flagged by gcc relating to
potential access to the ssr and cks variables while they are uninitialised.

I have addressed this by initialising the values to
the defaults present in sci_baud_calc_hscif().

It is my analysis that cks is always initialised if used
but that without this change ssr may be accessed while uninitialised.

The code altered by this patch was introduced by commit
f303b364b41d3fc5bf879799128958400b7859aa ("serial: sh-sci: HSCIF support").

Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 drivers/tty/serial/sh-sci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 931d6c3..7477e0e 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1887,9 +1887,9 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
 {
 	struct sci_port *s = to_sci_port(port);
 	struct plat_sci_reg *reg;
-	unsigned int baud, smr_val, max_baud, cks;
+	unsigned int baud, smr_val, max_baud, cks = 0;
 	int t = -1;
-	unsigned int srr;
+	unsigned int srr = 15;
 
 	/*
 	 * earlyprintk comes here early on with port->uartclk set to zero.
-- 
1.8.2.1


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

* [PATCH] serial: sh-sci: Initialise variables before access in sci_set_termios()
@ 2013-06-20 12:25 ` Simon Horman
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2013-06-20 12:25 UTC (permalink / raw)
  To: linux-arm-kernel

This change addresses two warnings that are flagged by gcc relating to
potential access to the ssr and cks variables while they are uninitialised.

I have addressed this by initialising the values to
the defaults present in sci_baud_calc_hscif().

It is my analysis that cks is always initialised if used
but that without this change ssr may be accessed while uninitialised.

The code altered by this patch was introduced by commit
f303b364b41d3fc5bf879799128958400b7859aa ("serial: sh-sci: HSCIF support").

Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 drivers/tty/serial/sh-sci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 931d6c3..7477e0e 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1887,9 +1887,9 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
 {
 	struct sci_port *s = to_sci_port(port);
 	struct plat_sci_reg *reg;
-	unsigned int baud, smr_val, max_baud, cks;
+	unsigned int baud, smr_val, max_baud, cks = 0;
 	int t = -1;
-	unsigned int srr;
+	unsigned int srr = 15;
 
 	/*
 	 * earlyprintk comes here early on with port->uartclk set to zero.
-- 
1.8.2.1

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

* Re: [PATCH] serial: sh-sci: Initialise variables before access in sci_set_termios()
  2013-06-20 12:25 ` Simon Horman
  (?)
@ 2013-06-24 23:34   ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2013-06-24 23:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jun 20, 2013 at 09:25:02PM +0900, Simon Horman wrote:
> This change addresses two warnings that are flagged by gcc relating to
> potential access to the ssr and cks variables while they are uninitialised.
> 
> I have addressed this by initialising the values to
> the defaults present in sci_baud_calc_hscif().
> 
> It is my analysis that cks is always initialised if used
> but that without this change ssr may be accessed while uninitialised.
> 
> The code altered by this patch was introduced by commit
> f303b364b41d3fc5bf879799128958400b7859aa ("serial: sh-sci: HSCIF support").
> 
> Reported-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> ---

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

* Re: [PATCH] serial: sh-sci: Initialise variables before access in sci_set_termios()
@ 2013-06-24 23:34   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2013-06-24 23:34 UTC (permalink / raw)
  To: Simon Horman
  Cc: linux-sh, Arnd Bergmann, Jiri Slaby, Ulrich Hecht, Magnus Damm,
	Paul Mundt, Olof Johansson, linux-serial, linux-arm-kernel

On Thu, Jun 20, 2013 at 09:25:02PM +0900, Simon Horman wrote:
> This change addresses two warnings that are flagged by gcc relating to
> potential access to the ssr and cks variables while they are uninitialised.
> 
> I have addressed this by initialising the values to
> the defaults present in sci_baud_calc_hscif().
> 
> It is my analysis that cks is always initialised if used
> but that without this change ssr may be accessed while uninitialised.
> 
> The code altered by this patch was introduced by commit
> f303b364b41d3fc5bf879799128958400b7859aa ("serial: sh-sci: HSCIF support").
> 
> Reported-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> ---

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

* [PATCH] serial: sh-sci: Initialise variables before access in sci_set_termios()
@ 2013-06-24 23:34   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2013-06-24 23:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jun 20, 2013 at 09:25:02PM +0900, Simon Horman wrote:
> This change addresses two warnings that are flagged by gcc relating to
> potential access to the ssr and cks variables while they are uninitialised.
> 
> I have addressed this by initialising the values to
> the defaults present in sci_baud_calc_hscif().
> 
> It is my analysis that cks is always initialised if used
> but that without this change ssr may be accessed while uninitialised.
> 
> The code altered by this patch was introduced by commit
> f303b364b41d3fc5bf879799128958400b7859aa ("serial: sh-sci: HSCIF support").
> 
> Reported-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> ---

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

end of thread, other threads:[~2013-06-24 23:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-20 12:25 [PATCH] serial: sh-sci: Initialise variables before access in sci_set_termios() Simon Horman
2013-06-20 12:25 ` Simon Horman
2013-06-20 12:25 ` Simon Horman
2013-06-24 23:34 ` Greg Kroah-Hartman
2013-06-24 23:34   ` Greg Kroah-Hartman
2013-06-24 23:34   ` Greg Kroah-Hartman

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.