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

ivanhu ivan.hu at canonical.com
Wed Jul 24 06:46:04 UTC 2019



On 7/5/19 12:39 AM, 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: Ivan Hu <ivan.hu at canonical.com>



More information about the fwts-devel mailing list