frontends/va: Fix *num_entrypoints check.
authorVinson Lee <vlee@freedesktop.org>
Thu, 29 Oct 2020 02:47:42 +0000 (19:47 -0700)
committerVinson Lee <vlee@freedesktop.org>
Tue, 17 Nov 2020 00:04:28 +0000 (16:04 -0800)
Fix defect reported by Coverity Scan.

Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking num_entrypoints suggests that it
may be null, but it has already been dereferenced on all paths
leading to the check.

Fixes: 5bcaa1b9e970 ("st/va: add encode entrypoint v2")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7360>

src/gallium/frontends/va/config.c

index fe96be0..66ed913 100644 (file)
@@ -99,7 +99,7 @@ vlVaQueryConfigEntrypoints(VADriverContextP ctx, VAProfile profile,
                                PIPE_VIDEO_CAP_SUPPORTED))
       entrypoint_list[(*num_entrypoints)++] = VAEntrypointEncSlice;
 
-   if (num_entrypoints == 0)
+   if (*num_entrypoints == 0)
       return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
 
    assert(*num_entrypoints <= ctx->max_entrypoints);