From 625425326dac0b660f15cfcea8e35292572a3284 Mon Sep 17 00:00:00 2001 From: Alysa Liu Date: Mon, 26 May 2025 16:32:14 -0400 Subject: [PATCH] rocr: Add check for 'value' pointer Replaces assertion check assert(value) with explicit null pointer check Returns HSA_STATUS_ERROR_INVALID_ARGUMENT on null valuesrocr: Add check for 'value' pointer Signed-off-by: Alysa Liu --- runtime/hsa-runtime/libamdhsacode/amd_hsa_code.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/runtime/hsa-runtime/libamdhsacode/amd_hsa_code.cpp b/runtime/hsa-runtime/libamdhsacode/amd_hsa_code.cpp index 9e49ba9d53..f6eb92d241 100644 --- a/runtime/hsa-runtime/libamdhsacode/amd_hsa_code.cpp +++ b/runtime/hsa-runtime/libamdhsacode/amd_hsa_code.cpp @@ -122,7 +122,9 @@ namespace code { hsa_status_t Symbol::GetInfo(hsa_code_symbol_info_t attribute, void *value) { - assert(value); + if (!value) { + return HSA_STATUS_ERROR_INVALID_ARGUMENT; + } switch (attribute) { case HSA_CODE_SYMBOL_INFO_TYPE: { @@ -145,9 +147,6 @@ namespace code { } case HSA_CODE_SYMBOL_INFO_MODULE_NAME: { std::string ModuleName = GetModuleName(); - if (!value) { - return HSA_STATUS_ERROR_INVALID_ARGUMENT; - } memset(value, 0x0, ModuleName.size()); memcpy(value, ModuleName.c_str(), ModuleName.size()); break;