Mesa (master): frontends/va: Fix *num_entrypoints check.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Nov 17 00:14:57 UTC 2020


Module: Mesa
Branch: master
Commit: 7820c8c13ff3e9367b208f09059c940a1629f708
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7820c8c13ff3e9367b208f09059c940a1629f708

Author: Vinson Lee <vlee at freedesktop.org>
Date:   Wed Oct 28 19:47:42 2020 -0700

frontends/va: Fix *num_entrypoints check.

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 at freedesktop.org>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7360>

---

 src/gallium/frontends/va/config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/frontends/va/config.c b/src/gallium/frontends/va/config.c
index fe96be0b38a..66ed913e7e0 100644
--- a/src/gallium/frontends/va/config.c
+++ b/src/gallium/frontends/va/config.c
@@ -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);



More information about the mesa-commit mailing list