tty: serial_core, remove state checks in uart_poll*
authorJiri Slaby <jslaby@suse.cz>
Wed, 15 Mar 2017 11:00:23 +0000 (12:00 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Mar 2017 05:17:11 +0000 (14:17 +0900)
commit22077b091a4720d4336bd806e9c93b2a81fcc38a
tree40670e2f9203809c0995a878e53757a0ab67e2e5
parentfab8a02b73eb2a42c589f943c377143f04b2bb73
tty: serial_core, remove state checks in uart_poll*

Coverity complains about uart_state checks in polling functions. And it
is indeed correct. We do something like this:
struct uart_state *state = drv->state + line;
if (!state)
return;

Adding 'line' to drv->state would move the potential NULL pointer to
something near NULL and the check is useless. Even if we checked pure
drv->state, nothing guarantees it is not freed and NULLed after the
check. So if the only user of this interface (kgdboc) needs to assure
something, this is neither the correct thing, nor place to do so.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: linux-serial@vger.kernel.org
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: kgdb-bugreport@lists.sourceforge.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/serial_core.c