[Mesa-dev] [RFC 5/7] nir: fix block iterator coverity warning
Connor Abbott
cwabbott0 at gmail.com
Wed May 18 19:06:44 UTC 2016
nir_cf_node_cf_tree_next() never returns NULL, maybe we can mark it as
such? Also, what is coverity saying... we never dereference anything
here, only inside the functions themselves...
On Wed, May 18, 2016 at 11:54 AM, Rob Clark <robdclark at gmail.com> wrote:
> From: Rob Clark <robclark at freedesktop.org>
>
> For example, in nir_opt_dead_cf.c:140:
>
> CID 1358914 (#1 of 1): Dereference null return value (NULL_RETURNS)13.
> dereference: Dereferencing a null pointer block.
> ---
> src/compiler/nir/nir.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
> index a21a7bd..05209ad 100644
> --- a/src/compiler/nir/nir.h
> +++ b/src/compiler/nir/nir.h
> @@ -2195,7 +2195,7 @@ nir_block *nir_cf_node_cf_tree_next(nir_cf_node *node);
>
> #define nir_foreach_block_in_cf_node(block, node) \
> for (nir_block *block = nir_cf_node_cf_tree_first(node); \
> - block != nir_cf_node_cf_tree_next(node); \
> + block && (block != nir_cf_node_cf_tree_next(node)); \
> block = nir_block_cf_tree_next(block))
>
> /* If the following CF node is an if, this function returns that if.
> --
> 2.5.5
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list