summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOscar Carter <oscar.carter@gmx.com>2020-05-10 12:14:26 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-05-27 16:43:11 +0200
commitda479c74790b8b8be88c84503593bb07105869fe (patch)
tree63047d26ce3dfd9e633116442aadb1a40a66bb1c
parent03e79b6c34e698da9c17da95f2db76e6a2f2578c (diff)
downloadlinux-stable-da479c74790b8b8be88c84503593bb07105869fe.tar.gz
linux-stable-da479c74790b8b8be88c84503593bb07105869fe.tar.bz2
linux-stable-da479c74790b8b8be88c84503593bb07105869fe.zip
staging: greybus: Fix uninitialized scalar variable
commit 34625c1931f8204c234c532b446b9f53c69f4b68 upstream. In the "gb_tty_set_termios" function the "newline" variable is declared but not initialized. So the "flow_control" member is not initialized and the OR / AND operations with itself results in an undefined value in this member. The purpose of the code is to set the flow control type, so remove the OR / AND self operator and set the value directly. Addresses-Coverity-ID: 1374016 ("Uninitialized scalar variable") Fixes: e55c25206d5c9 ("greybus: uart: Handle CRTSCTS flag in termios") Signed-off-by: Oscar Carter <oscar.carter@gmx.com> Cc: stable <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20200510101426.23631-1-oscar.carter@gmx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/greybus/uart.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c
index c6d01b800d3c..2b297df88bdd 100644
--- a/drivers/staging/greybus/uart.c
+++ b/drivers/staging/greybus/uart.c
@@ -538,9 +538,9 @@ static void gb_tty_set_termios(struct tty_struct *tty,
}
if (C_CRTSCTS(tty) && C_BAUD(tty) != B0)
- newline.flow_control |= GB_SERIAL_AUTO_RTSCTS_EN;
+ newline.flow_control = GB_SERIAL_AUTO_RTSCTS_EN;
else
- newline.flow_control &= ~GB_SERIAL_AUTO_RTSCTS_EN;
+ newline.flow_control = 0;
if (memcmp(&gb_tty->line_coding, &newline, sizeof(newline))) {
memcpy(&gb_tty->line_coding, &newline, sizeof(newline));