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: 5bcaa1b9e9 ("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>
(cherry picked from commit 7820c8c13f)
This commit is contained in:
Vinson Lee 2020-10-28 19:47:42 -07:00 committed by Dylan Baker
parent 40f664a9e5
commit 28c5ca4588
2 changed files with 2 additions and 2 deletions

View file

@ -1795,7 +1795,7 @@
"description": "frontends/va: Fix *num_entrypoints check.",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": "5bcaa1b9e9707aea7be73b406345bb9e46f92a18"
},

View 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);