Patchwork [v3,16/16] chardev: ensure termios is fully initialized

login
register
mail settings
Submitter Daniel P. Berrange
Date Feb. 11, 2019, 6:24 p.m.
Message ID <20190211182442.8542-17-berrange@redhat.com>
Download mbox | patch
Permalink /patch/723241/
State New
Headers show

Comments

Daniel P. Berrange - Feb. 11, 2019, 6:24 p.m.
valgrind on the test-char.c code reports that 'struct termios' contains
uninitialized memory.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 chardev/char-serial.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/chardev/char-serial.c b/chardev/char-serial.c
index 3299b46853..a8bae31b8d 100644
--- a/chardev/char-serial.c
+++ b/chardev/char-serial.c
@@ -57,7 +57,7 @@  static void qmp_chardev_open_serial(Chardev *chr,
 static void tty_serial_init(int fd, int speed,
                             int parity, int data_bits, int stop_bits)
 {
-    struct termios tty;
+    struct termios tty = {0};
     speed_t spd;
 
 #if 0