linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tty: Fix potentialy used uninitialized variable
@ 2015-08-08  9:24 Tomer Barletz
  2015-08-08  9:37 ` Richard Weinberger
  0 siblings, 1 reply; 2+ messages in thread
From: Tomer Barletz @ 2015-08-08  9:24 UTC (permalink / raw)
  To: gregkh, jslaby; +Cc: linux-kernel, Tomer Barletz

Initialize size to 0, as it may be used uninitialized in case
read_mem32() fails.

Signed-off-by: Tomer Barletz <barletz@gmail.com>
---
 drivers/tty/nozomi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c
index 80f9de9..d70e9e4 100644
--- a/drivers/tty/nozomi.c
+++ b/drivers/tty/nozomi.c
@@ -816,7 +816,7 @@ static int send_data(enum port_type index, struct nozomi *dc)
 static int receive_data(enum port_type index, struct nozomi *dc)
 {
 	u8 buf[RECEIVE_BUF_MAX] = { 0 };
-	int size;
+	int size = 0;
 	u32 offset = 4;
 	struct port *port = &dc->port[index];
 	void __iomem *addr = port->dl_addr[port->toggle_dl];
-- 
2.4.3


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

* Re: [PATCH] tty: Fix potentialy used uninitialized variable
  2015-08-08  9:24 [PATCH] tty: Fix potentialy used uninitialized variable Tomer Barletz
@ 2015-08-08  9:37 ` Richard Weinberger
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Weinberger @ 2015-08-08  9:37 UTC (permalink / raw)
  To: Tomer Barletz; +Cc: Greg KH, jslaby, LKML

On Sat, Aug 8, 2015 at 11:24 AM, Tomer Barletz <barletz@gmail.com> wrote:
> Initialize size to 0, as it may be used uninitialized in case
> read_mem32() fails.

Instead of papering over the issue better cleanup read_mem32() such that
a failure can be detected. :-)

-- 
Thanks,
//richard

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

end of thread, other threads:[~2015-08-08  9:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-08  9:24 [PATCH] tty: Fix potentialy used uninitialized variable Tomer Barletz
2015-08-08  9:37 ` Richard Weinberger

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