summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Faye-Lund <erik.faye-lund@collabora.com>2024-04-22 14:56:24 +0200
committerEric Engestrom <eric@engestrom.ch>2024-04-30 18:51:13 +0200
commit005135424994d80940b7fc2732d18836433b3803 (patch)
tree67a7e41cd8568ef7a5c6ec85392ce1c6e81f794f
parent39e6ab2483fe33836089ef5300bf6b9c68a087f6 (diff)
panvk: avoid dereferencing a null-pointer
If we're passed a memory-info, but no memory-prop, we'd end up dereferencing a null-pointer here. Let's use a fallback struct instead, similar to what RADV does. Fixes: d970fe2e9d6 ("panfrost: Add a Vulkan driver for Midgard/Bifrost GPUs") CID: 1496060 Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28856> (cherry picked from commit 3b3df7b8a98c4171e402a7c4e7170b9d937aae09)
-rw-r--r--.pick_status.json2
-rw-r--r--src/panfrost/vulkan/panvk_formats.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/.pick_status.json b/.pick_status.json
index d89d082445a..9c6b0a02aff 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1214,7 +1214,7 @@
"description": "panvk: avoid dereferencing a null-pointer",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": "d970fe2e9d6a8e9997a0ce212146d62013b3b455",
"notes": null
diff --git a/src/panfrost/vulkan/panvk_formats.c b/src/panfrost/vulkan/panvk_formats.c
index 956d4691677..3186b5dedff 100644
--- a/src/panfrost/vulkan/panvk_formats.c
+++ b/src/panfrost/vulkan/panvk_formats.c
@@ -414,6 +414,13 @@ panvk_GetPhysicalDeviceImageFormatProperties2(
* present and VkExternalImageFormatProperties will be ignored.
*/
if (external_info && external_info->handleType != 0) {
+ VkExternalImageFormatProperties fallback_external_props;
+
+ if (!external_props) {
+ memset(&fallback_external_props, 0, sizeof(fallback_external_props));
+ external_props = &fallback_external_props;
+ }
+
result = panvk_get_external_image_format_properties(
physical_device, base_info, external_info->handleType,
&external_props->externalMemoryProperties);