[llvm] [offload][nfc] Return an explicit error from createInterop (PR #220951)
Ivan R. Ivanov via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 3 07:46:05 PDT 2026
https://github.com/ivanradanov created https://github.com/llvm/llvm-project/pull/220951
The return type is Expected<omp_interop_val_t *> so a nullptr can be incorrectly interpreted as a success and subsequently the nullptr could get dereferenced. Make the error explicit.
>From 1b16463dd33af3a608b15377bcec7a5e7582ec1a Mon Sep 17 00:00:00 2001
From: Ivan Radanov Ivanov <iivanov at nvidia.com>
Date: Thu, 3 Sep 2026 07:29:00 -0700
Subject: [PATCH] [offload][nfc] Return an explicit error from createInterop
The return type is Expected<omp_interop_val_t *> so a nullptr can be
incorrectly interpreted as a success and subsequently the nullptr could get
dereferenced. Make the error explicit.
---
offload/plugins-nextgen/common/include/PluginInterface.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/offload/plugins-nextgen/common/include/PluginInterface.h b/offload/plugins-nextgen/common/include/PluginInterface.h
index 7b7a62bc2d467..bdc866357acec 100644
--- a/offload/plugins-nextgen/common/include/PluginInterface.h
+++ b/offload/plugins-nextgen/common/include/PluginInterface.h
@@ -1300,7 +1300,8 @@ struct GenericDeviceTy : public DeviceAllocatorTy {
virtual Expected<omp_interop_val_t *>
createInterop(int32_t InteropType, interop_spec_t &InteropSpec) {
- return nullptr;
+ return Plugin::error(error::ErrorCode::UNSUPPORTED,
+ "%s not supported by platform", __func__);
}
virtual Error releaseInterop(omp_interop_val_t *Interop) {
More information about the llvm-commits
mailing list