From 2ee83edb560c19c1496248c74cc9f40aab3b2af9 Mon Sep 17 00:00:00 2001 From: Aaron Greig Date: Thu, 15 Jun 2023 13:50:12 +0100 Subject: [PATCH] Fix Coverity issue: dead code in bindless image validation. --- include/ur_api.h | 10 ++++------ scripts/core/exp-bindless-images.yml | 4 ++-- source/adapters/null/ur_nullddi.cpp | 4 ++-- source/loader/layers/tracing/ur_trcddi.cpp | 4 ++-- source/loader/layers/validation/ur_valddi.cpp | 12 ++---------- source/loader/ur_ldrddi.cpp | 4 ++-- source/loader/ur_libapi.cpp | 10 ++++------ source/ur_api.cpp | 10 ++++------ 8 files changed, 22 insertions(+), 36 deletions(-) diff --git a/include/ur_api.h b/include/ur_api.h index 2ffc1fb39c..41377a4108 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -6366,14 +6366,12 @@ urBindlessImagesImageCopyExp( /// + `NULL == hImageMem` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION /// + `::UR_IMAGE_INFO_DEPTH < propName` -/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER -/// + `NULL == pPropValue` -/// + `NULL == pPropSizeRet` -/// + `pPropValue == NULL && pPropSizeRet == NULL` /// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// + If `propName` is not supported by the adapter. /// - ::UR_RESULT_ERROR_INVALID_SIZE /// + If `propSize` is less than the real number of bytes needed to return the info. +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `pPropValue == NULL && pPropSizeRet == NULL` /// - ::UR_RESULT_ERROR_INVALID_DEVICE /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY @@ -6381,8 +6379,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp( ur_exp_image_mem_handle_t hImageMem, ///< [in] handle to the image memory ur_image_info_t propName, ///< [in] queried info name - void *pPropValue, ///< [out] returned query value - size_t *pPropSizeRet ///< [out] returned query value size + void *pPropValue, ///< [out][optional] returned query value + size_t *pPropSizeRet ///< [out][optional] returned query value size ); /////////////////////////////////////////////////////////////////////////////// diff --git a/scripts/core/exp-bindless-images.yml b/scripts/core/exp-bindless-images.yml index b9bc51ca79..b684f3b80e 100644 --- a/scripts/core/exp-bindless-images.yml +++ b/scripts/core/exp-bindless-images.yml @@ -329,10 +329,10 @@ params: desc: "[in] queried info name" - type: void* name: pPropValue - desc: "[out] returned query value" + desc: "[out][optional] returned query value" - type: "size_t*" name: pPropSizeRet - desc: "[out] returned query value size" + desc: "[out][optional] returned query value size" returns: - $X_RESULT_ERROR_UNSUPPORTED_ENUMERATION: - "If `propName` is not supported by the adapter." diff --git a/source/adapters/null/ur_nullddi.cpp b/source/adapters/null/ur_nullddi.cpp index 4a6c8eaa84..5c5dbe14c8 100644 --- a/source/adapters/null/ur_nullddi.cpp +++ b/source/adapters/null/ur_nullddi.cpp @@ -3740,8 +3740,8 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp( __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp( ur_exp_image_mem_handle_t hImageMem, ///< [in] handle to the image memory ur_image_info_t propName, ///< [in] queried info name - void *pPropValue, ///< [out] returned query value - size_t *pPropSizeRet ///< [out] returned query value size + void *pPropValue, ///< [out][optional] returned query value + size_t *pPropSizeRet ///< [out][optional] returned query value size ) try { ur_result_t result = UR_RESULT_SUCCESS; diff --git a/source/loader/layers/tracing/ur_trcddi.cpp b/source/loader/layers/tracing/ur_trcddi.cpp index 49503e8eba..f19e1f8141 100644 --- a/source/loader/layers/tracing/ur_trcddi.cpp +++ b/source/loader/layers/tracing/ur_trcddi.cpp @@ -4246,8 +4246,8 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp( __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp( ur_exp_image_mem_handle_t hImageMem, ///< [in] handle to the image memory ur_image_info_t propName, ///< [in] queried info name - void *pPropValue, ///< [out] returned query value - size_t *pPropSizeRet ///< [out] returned query value size + void *pPropValue, ///< [out][optional] returned query value + size_t *pPropSizeRet ///< [out][optional] returned query value size ) { auto pfnImageGetInfoExp = context.urDdiTable.BindlessImagesExp.pfnImageGetInfoExp; diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index 52b7e96532..c8b9e52258 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -5396,8 +5396,8 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp( __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp( ur_exp_image_mem_handle_t hImageMem, ///< [in] handle to the image memory ur_image_info_t propName, ///< [in] queried info name - void *pPropValue, ///< [out] returned query value - size_t *pPropSizeRet ///< [out] returned query value size + void *pPropValue, ///< [out][optional] returned query value + size_t *pPropSizeRet ///< [out][optional] returned query value size ) { auto pfnImageGetInfoExp = context.urDdiTable.BindlessImagesExp.pfnImageGetInfoExp; @@ -5411,14 +5411,6 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp( return UR_RESULT_ERROR_INVALID_NULL_HANDLE; } - if (NULL == pPropValue) { - return UR_RESULT_ERROR_INVALID_NULL_POINTER; - } - - if (NULL == pPropSizeRet) { - return UR_RESULT_ERROR_INVALID_NULL_POINTER; - } - if (pPropValue == NULL && pPropSizeRet == NULL) { return UR_RESULT_ERROR_INVALID_NULL_POINTER; } diff --git a/source/loader/ur_ldrddi.cpp b/source/loader/ur_ldrddi.cpp index 366f9c3b52..d587c59565 100644 --- a/source/loader/ur_ldrddi.cpp +++ b/source/loader/ur_ldrddi.cpp @@ -5234,8 +5234,8 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp( __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp( ur_exp_image_mem_handle_t hImageMem, ///< [in] handle to the image memory ur_image_info_t propName, ///< [in] queried info name - void *pPropValue, ///< [out] returned query value - size_t *pPropSizeRet ///< [out] returned query value size + void *pPropValue, ///< [out][optional] returned query value + size_t *pPropSizeRet ///< [out][optional] returned query value size ) { ur_result_t result = UR_RESULT_SUCCESS; diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index 7cd7619951..c6928875dc 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -5649,22 +5649,20 @@ ur_result_t UR_APICALL urBindlessImagesImageCopyExp( /// + `NULL == hImageMem` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION /// + `::UR_IMAGE_INFO_DEPTH < propName` -/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER -/// + `NULL == pPropValue` -/// + `NULL == pPropSizeRet` -/// + `pPropValue == NULL && pPropSizeRet == NULL` /// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// + If `propName` is not supported by the adapter. /// - ::UR_RESULT_ERROR_INVALID_SIZE /// + If `propSize` is less than the real number of bytes needed to return the info. +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `pPropValue == NULL && pPropSizeRet == NULL` /// - ::UR_RESULT_ERROR_INVALID_DEVICE /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp( ur_exp_image_mem_handle_t hImageMem, ///< [in] handle to the image memory ur_image_info_t propName, ///< [in] queried info name - void *pPropValue, ///< [out] returned query value - size_t *pPropSizeRet ///< [out] returned query value size + void *pPropValue, ///< [out][optional] returned query value + size_t *pPropSizeRet ///< [out][optional] returned query value size ) try { auto pfnImageGetInfoExp = ur_lib::context->urDdiTable.BindlessImagesExp.pfnImageGetInfoExp; diff --git a/source/ur_api.cpp b/source/ur_api.cpp index d1850ebfd1..ef1a256d74 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -4758,22 +4758,20 @@ ur_result_t UR_APICALL urBindlessImagesImageCopyExp( /// + `NULL == hImageMem` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION /// + `::UR_IMAGE_INFO_DEPTH < propName` -/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER -/// + `NULL == pPropValue` -/// + `NULL == pPropSizeRet` -/// + `pPropValue == NULL && pPropSizeRet == NULL` /// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// + If `propName` is not supported by the adapter. /// - ::UR_RESULT_ERROR_INVALID_SIZE /// + If `propSize` is less than the real number of bytes needed to return the info. +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `pPropValue == NULL && pPropSizeRet == NULL` /// - ::UR_RESULT_ERROR_INVALID_DEVICE /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp( ur_exp_image_mem_handle_t hImageMem, ///< [in] handle to the image memory ur_image_info_t propName, ///< [in] queried info name - void *pPropValue, ///< [out] returned query value - size_t *pPropSizeRet ///< [out] returned query value size + void *pPropValue, ///< [out][optional] returned query value + size_t *pPropSizeRet ///< [out][optional] returned query value size ) { ur_result_t result = UR_RESULT_SUCCESS; return result;