tools: kwboot: Initialize rfds to zero
authorPali Rohár <pali@kernel.org>
Mon, 25 Oct 2021 13:12:52 +0000 (15:12 +0200)
committerStefan Roese <sr@denx.de>
Wed, 3 Nov 2021 05:45:26 +0000 (06:45 +0100)
Explicitly zero out the rfds fd_set with FD_ZERO() before using it.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
tools/kwboot.c

index 7e1be29..695d433 100644 (file)
@@ -1151,6 +1151,7 @@ kwboot_terminal(int tty)
                fd_set rfds;
                int nfds = 0;
 
+               FD_ZERO(&rfds);
                FD_SET(tty, &rfds);
                nfds = nfds < tty ? tty : nfds;