From 0690ad0bacfdd60ecbe3d5007d984f6ca1e281e9 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 9 Aug 2021 13:22:26 -0700 Subject: [PATCH] vkr: remove some manual NULL checks They are checked by the decoder since ee9db8b0 ("vkr: validate non-optional pointers") This reverts 44448cf7 ("vkr: fix some null dereferences") except for the check for args->streamCount in vkr_dispatch_vkExecuteCommandStreamsMESA, which is unnecessary but good to have. Signed-off-by: Chia-I Wu Reviewed-by: Yiwei Zhang Reviewed-by: Ryan Neph --- src/venus/vkr_instance.c | 23 ++--------------------- src/venus/vkr_transport.c | 21 ++------------------- 2 files changed, 4 insertions(+), 40 deletions(-) diff --git a/src/venus/vkr_instance.c b/src/venus/vkr_instance.c index 4426c25..33fdef7 100644 --- a/src/venus/vkr_instance.c +++ b/src/venus/vkr_instance.c @@ -12,27 +12,18 @@ #include "vkr_physical_device.h" static void -vkr_dispatch_vkEnumerateInstanceVersion(struct vn_dispatch_context *dispatch, +vkr_dispatch_vkEnumerateInstanceVersion(UNUSED struct vn_dispatch_context *dispatch, struct vn_command_vkEnumerateInstanceVersion *args) { - struct vkr_context *ctx = dispatch->data; - - if (!args->pApiVersion) { - vkr_cs_decoder_set_fatal(&ctx->decoder); - return; - } - vn_replace_vkEnumerateInstanceVersion_args_handle(args); args->ret = vkEnumerateInstanceVersion(args->pApiVersion); } static void vkr_dispatch_vkEnumerateInstanceExtensionProperties( - struct vn_dispatch_context *dispatch, + UNUSED struct vn_dispatch_context *dispatch, struct vn_command_vkEnumerateInstanceExtensionProperties *args) { - struct vkr_context *ctx = dispatch->data; - VkExtensionProperties private_extensions[] = { { .extensionName = "VK_EXT_command_serialization", @@ -42,11 +33,6 @@ vkr_dispatch_vkEnumerateInstanceExtensionProperties( }, }; - if (!args->pPropertyCount) { - vkr_cs_decoder_set_fatal(&ctx->decoder); - return; - } - if (!args->pProperties) { *args->pPropertyCount = ARRAY_SIZE(private_extensions); args->ret = VK_SUCCESS; @@ -98,11 +84,6 @@ vkr_dispatch_vkCreateInstance(struct vn_dispatch_context *dispatch, return; } - if (!args->pCreateInfo) { - vkr_cs_decoder_set_fatal(&ctx->decoder); - return; - } - if (args->pCreateInfo->enabledLayerCount) { args->ret = VK_ERROR_LAYER_NOT_PRESENT; return; diff --git a/src/venus/vkr_transport.c b/src/venus/vkr_transport.c index 36365e4..acbc38f 100644 --- a/src/venus/vkr_transport.c +++ b/src/venus/vkr_transport.c @@ -20,11 +20,6 @@ vkr_dispatch_vkSetReplyCommandStreamMESA( struct vkr_context *ctx = dispatch->data; struct vkr_resource_attachment *att; - if (!args->pStream) { - vkr_cs_decoder_set_fatal(&ctx->decoder); - return; - } - att = util_hash_table_get(ctx->resource_table, uintptr_to_pointer(args->pStream->resourceId)); if (!att) { @@ -104,7 +99,7 @@ vkr_dispatch_vkExecuteCommandStreamsMESA( { struct vkr_context *ctx = dispatch->data; - if (!args->streamCount || !args->pStreams) { + if (!args->streamCount) { vkr_cs_decoder_set_fatal(&ctx->decoder); return; } @@ -168,11 +163,6 @@ vkr_dispatch_vkCreateRingMESA(struct vn_dispatch_context *dispatch, size_t size; struct vkr_ring *ring; - if (!info) { - vkr_cs_decoder_set_fatal(&ctx->decoder); - return; - } - att = util_hash_table_get(ctx->resource_table, uintptr_to_pointer(info->resourceId)); if (!att) { vkr_cs_decoder_set_fatal(&ctx->decoder); @@ -281,16 +271,9 @@ vkr_dispatch_vkWriteRingExtraMESA(struct vn_dispatch_context *dispatch, static void vkr_dispatch_vkGetVenusExperimentalFeatureData100000MESA( - struct vn_dispatch_context *dispatch, + UNUSED struct vn_dispatch_context *dispatch, struct vn_command_vkGetVenusExperimentalFeatureData100000MESA *args) { - struct vkr_context *ctx = dispatch->data; - - if (!args->pDataSize) { - vkr_cs_decoder_set_fatal(&ctx->decoder); - return; - } - const VkVenusExperimentalFeatures100000MESA features = { .memoryResourceAllocationSize = VK_TRUE, };