Skip to content

[Media_Common][Coverity] Fix NULL_FIELD dereferences in va_trace and va_dri2 - #898

Merged
XinfengZhang merged 1 commit into
intel:masterfrom
intel-mediadev:user/intel-mediadev/coverity-null-field-fix
Oct 23, 2026
Merged

XinfengZhang merged 1 commit into
intel:masterfrom
intel-mediadev:user/intel-mediadev/coverity-null-field-fix

Conversation

@intel-mediadev

Copy link
Copy Markdown
Contributor

[Media_Common][Coverity] Fix NULL_FIELD dereferences in va_trace and va_dri2

Fix two Coverity NULL_FIELD defects (CID 3528231, CID 3660939):

  1. va/va_trace.c (CID 3528231): In va_TraceVPrint(), fp_log is read from
    trace_ctx->plog_file->fp_log and passed directly to vfprintf/fflush without
    a null check. Since fp_log is set from fopen() output (which can return NULL
    on failure), dereferencing it unconditionally causes undefined behavior. All
    other sites in the file that use fp_log check it for null first (lines 744,
    920, 2113, 4307). Add the missing null guard before the FILE* use.

  2. va/x11/va_dri2.c (CID 3660939): VA_DRI2GetBuffers_internal() dereferences
    info->codes->major_opcode without checking info->codes for null. Both callers
    validate info->codes via XextCheckExtension/XextSimpleCheckExtension before
    calling this static helper, so this cannot be triggered in current code.
    Add a defensive early-return to make the function self-guarding and consistent
    with the pattern used in sibling functions.

Resolves: VSMGWL-85794

[Internal]
Commit_Type: Bugfix
Platforms: Gen8_12, Xe_Hpm, Xe_Lpm, Xe2_Hpm, Xe2_Lpm, Xe3_Hpm, Xe3_Lpm
OS: Linux
Feature impact: Misc
Resolves: VSMGWL-85794
Related-to: N/A

Co-Authored-By: Claude Code noreply@anthropic.com

…va_dri2

Fix two Coverity NULL_FIELD defects (CID 3528231, CID 3660939):

1. va/va_trace.c (CID 3528231): In va_TraceVPrint(), fp_log is read from
   trace_ctx->plog_file->fp_log and passed directly to vfprintf/fflush without
   a null check. Since fp_log is set from fopen() output (which can return NULL
   on failure), dereferencing it unconditionally causes undefined behavior. All
   other sites in the file that use fp_log check it for null first (lines 744,
   920, 2113, 4307). Add the missing null guard before the FILE* use.

2. va/x11/va_dri2.c (CID 3660939): VA_DRI2GetBuffers_internal() dereferences
   info->codes->major_opcode without checking info->codes for null. Both callers
   validate info->codes via XextCheckExtension/XextSimpleCheckExtension before
   calling this static helper, so this cannot be triggered in current code.
   Add a defensive early-return to make the function self-guarding and consistent
   with the pattern used in sibling functions.

Resolves: VSMGWL-85794

[Internal]
Commit_Type: Bugfix
Platforms: Gen8_12, Xe_Hpm, Xe_Lpm, Xe2_Hpm, Xe2_Lpm, Xe3_Hpm, Xe3_Lpm
OS: Linux
Feature impact: Misc
Resolves: VSMGWL-85794
Related-to: N/A

Co-Authored-By: Claude Code <noreply@anthropic.com>
@intel-mediadev
intel-mediadev marked this pull request as ready for review October 23, 2026 04:25
@intel-mediadev

Copy link
Copy Markdown
Contributor Author

/test skip-reviewer-check timeout=24 fail_retry=2

@XinfengZhang
XinfengZhang merged commit f052e98 into intel:master Oct 23, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants