ACK: [PATCH] fwts: lib: clean up static analysis warnings

Alex Hung alex.hung at canonical.com
Tue May 17 08:16:22 UTC 2016


On 2016-05-17 03:57 PM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Although this is not possible, I'd like to clean up a warning
> from static analysis just for the sake ensuring we never do
> a write to a null pointer to the buffer.
>
> CID 1354842:  Null pointer dereferences  (FORWARD_NULL)
> Passing null pointer "in_buf" to "write", which dereferences it.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>   src/lib/src/fwts_pipeio.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/lib/src/fwts_pipeio.c b/src/lib/src/fwts_pipeio.c
> index 859e63e..b501f7b 100644
> --- a/src/lib/src/fwts_pipeio.c
> +++ b/src/lib/src/fwts_pipeio.c
> @@ -206,7 +206,7 @@ int fwts_pipe_readwrite(
>   			*(ptr+out_size) = 0;
>   		}
>
> -		if (pollfds[1].revents) {
> +		if ((in_fd > 0) && in_buf && pollfds[1].revents) {
>   			n = write(in_fd, in_buf, in_size);
>
>   			if (n < 0) {
>

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



More information about the fwts-devel mailing list