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 <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
macos/master
Chia-I Wu 3 years ago
parent 99b28673b0
commit 0690ad0bac
  1. 23
      src/venus/vkr_instance.c
  2. 21
      src/venus/vkr_transport.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;

@ -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,
};

Loading…
Cancel
Save