Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1203235 > unrolled thread

[PATCH] tty: Fix potentialy used uninitialized variable

Started byTomer Barletz <barletz@gmail.com>
First post2015-08-08 11:30 +0200
Last post2015-08-08 11:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] tty: Fix potentialy used uninitialized variable Tomer Barletz <barletz@gmail.com> - 2015-08-08 11:30 +0200
    Re: [PATCH] tty: Fix potentialy used uninitialized variable Richard Weinberger <richard.weinberger@gmail.com> - 2015-08-08 11:40 +0200

#1203235 — [PATCH] tty: Fix potentialy used uninitialized variable

FromTomer Barletz <barletz@gmail.com>
Date2015-08-08 11:30 +0200
Subject[PATCH] tty: Fix potentialy used uninitialized variable
Message-ID<pV8BY-31i-7@gated-at.bofh.it>
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1203236

FromRichard Weinberger <richard.weinberger@gmail.com>
Date2015-08-08 11:40 +0200
Message-ID<pV8LE-3cw-7@gated-at.bofh.it>
In reply to#1203235
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web