Skip to content

vkr: work around a Use-of-uninitialized-value

Chia-I Wu requested to merge olv/virglrenderer:another-fix into master

Generated by https://gitlab.freedesktop.org/olv/venus-protocol/-/merge_requests/22.

VkDrmFormatModifierPropertiesListEXT::drmFormatModifierCount may be used uninitialized. It is a codegen bug but a proper fix breaks the protocol. Until we are ready to finalize the protocol, let's work around it.

It works so far because Mesa calls the function twice in a row. In the first call, pDrmFormatModifierProperties is NULL and the uninitialized value is not used. Instead, it is initialized by the host driver.

In the second call, because of how the temp pool works, the memory gets reused and the "uninitialized value" is already initialized. Thanks goes to Yiwei for figuring this out.

/cc @zzyiwei @ryanneph

Merge request reports