Skip to content

Commit 34625c1

Browse files
Oscar Cartergregkh
authored andcommitted
staging: greybus: Fix uninitialized scalar variable
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: e55c252 ("greybus: uart: Handle CRTSCTS flag in termios") Signed-off-by: Oscar Carter <[email protected]> Cc: stable <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b17884c commit 34625c1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/staging/greybus/uart.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,9 +537,9 @@ static void gb_tty_set_termios(struct tty_struct *tty,
537537
}
538538

539539
if (C_CRTSCTS(tty) && C_BAUD(tty) != B0)
540-
newline.flow_control |= GB_SERIAL_AUTO_RTSCTS_EN;
540+
newline.flow_control = GB_SERIAL_AUTO_RTSCTS_EN;
541541
else
542-
newline.flow_control &= ~GB_SERIAL_AUTO_RTSCTS_EN;
542+
newline.flow_control = 0;
543543

544544
if (memcmp(&gb_tty->line_coding, &newline, sizeof(newline))) {
545545
memcpy(&gb_tty->line_coding, &newline, sizeof(newline));

0 commit comments

Comments
 (0)