ACK: [PATCH] lib: fwts_pipeio: zero pollfds to squish a static analysis warning

Alex Hung alex.hung at canonical.com
Thu Jul 4 17:42:52 UTC 2019


On 2019-07-04 10:39 a.m., Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
> 
> Static analysis is warning that the revents field on pollfd[0] may
> be uninitialized.  Although the system call should set this, zero
> pollfds to silcence the static analysis warning and also catch any
> unforseen poll bugs.
> 
> Addresses-Coverity: ("Uninitialized scalar variable")
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>  src/lib/src/fwts_pipeio.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/lib/src/fwts_pipeio.c b/src/lib/src/fwts_pipeio.c
> index 659b125a..afd4b431 100644
> --- a/src/lib/src/fwts_pipeio.c
> +++ b/src/lib/src/fwts_pipeio.c
> @@ -161,6 +161,8 @@ int fwts_pipe_readwrite(
>  
>  	*out_len = 0;
>  
> +	memset(&pollfds, 0, sizeof(pollfds));
> +
>  	pollfds[0].fd = out_fd;
>  	pollfds[0].events = POLLIN;
>  	pollfds[1].fd = in_fd;
> 


Acked-by: Alex Hung <alex.hung at canonical.com>



More information about the fwts-devel mailing list