summaryrefslogtreecommitdiff
path: root/offload/liboffload/src
diff options
context:
space:
mode:
authorJoseph Huber <huberjn@outlook.com>2025-05-27 13:43:29 -0500
committerGitHub <noreply@github.com>2025-05-27 13:43:29 -0500
commita9b64bb3180dab6d28bf800a641f9a9ad54d2c0c (patch)
tree6f696baf36e75002239f441fea743bf59523609f /offload/liboffload/src
parent20f9f1fc02c294fa98d23e1cf1b09ea6d9679145 (diff)
[Offload] Fix segfault when looking for host device name (#141632)
Summary: This is done using the generic device into pointe, but no such thing exists for the host device, leading to a segfault. This patch fixes that for now, but in the future we should probably be more careful in general handling the possibility that the handle is null everywhere. Fixes: https://github.com/llvm/llvm-project/issues/141434
Diffstat (limited to 'offload/liboffload/src')
-rw-r--r--offload/liboffload/src/OffloadImpl.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/offload/liboffload/src/OffloadImpl.cpp b/offload/liboffload/src/OffloadImpl.cpp
index c6f64d218cd2..f2a02d1cff94 100644
--- a/offload/liboffload/src/OffloadImpl.cpp
+++ b/offload/liboffload/src/OffloadImpl.cpp
@@ -230,6 +230,12 @@ Error olGetDeviceInfoImplDetail(ol_device_handle_t Device,
// Find the info if it exists under any of the given names
auto GetInfo = [&](std::vector<std::string> Names) {
InfoQueueTy DevInfo;
+ if (Device == HostDevice())
+ return std::string("Host");
+
+ if (!Device->Device)
+ return std::string("");
+
if (auto Err = Device->Device->obtainInfoImpl(DevInfo))
return std::string("");