1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
From cdaa89e30e12d247a8086763d341e5f020151b67 Mon Sep 17 00:00:00 2001
From: Jonathan Liu <net147@gmail.com>
Date: Mon, 9 Mar 2015 22:35:56 +1100
Subject: [PATCH] Unix: Clear serial_struct instances
Silences the following Valgrind warning:
Conditional jump or move depends on uninitialised value(s)
Upstream-Status: Backport from 5.5 branch
Change-Id: I8fd8cfd6aa6f75ed515e6151cfc282faca508bdc
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Signed-off-by: Jonathan Liu <net147@gmail.com>
---
src/serialport/qserialport_unix.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/serialport/qserialport_unix.cpp b/src/serialport/qserialport_unix.cpp
index cda73b2..62c454c 100644
--- a/src/serialport/qserialport_unix.cpp
+++ b/src/serialport/qserialport_unix.cpp
@@ -451,6 +451,8 @@ QSerialPortPrivate::setStandardBaudRate(qint32 baudRate, QSerialPort::Directions
{
struct serial_struct currentSerialInfo;
+ ::memset(¤tSerialInfo, 0, sizeof(currentSerialInfo));
+
if ((::ioctl(descriptor, TIOCGSERIAL, ¤tSerialInfo) != -1)
&& (currentSerialInfo.flags & ASYNC_SPD_CUST)) {
currentSerialInfo.flags &= ~ASYNC_SPD_CUST;
@@ -481,6 +483,8 @@ QSerialPortPrivate::setCustomBaudRate(qint32 baudRate, QSerialPort::Directions d
struct serial_struct currentSerialInfo;
+ ::memset(¤tSerialInfo, 0, sizeof(currentSerialInfo));
+
if (::ioctl(descriptor, TIOCGSERIAL, ¤tSerialInfo) == -1)
return decodeSystemError();
--
2.3.5
|