[Openmp-commits] [PATCH] D116716: [OpenMP][Offloading] Fixed a crash caused by dereferencing nullptr

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Jan 5 20:04:45 PST 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGaab62aab0431: [OpenMP][Offloading] Fixed a crash caused by dereferencing nullptr (authored by tianshilei1992).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116716/new/

https://reviews.llvm.org/D116716

Files:
  openmp/libomptarget/src/device.cpp


Index: openmp/libomptarget/src/device.cpp
===================================================================
--- openmp/libomptarget/src/device.cpp
+++ openmp/libomptarget/src/device.cpp
@@ -305,7 +305,9 @@
     DataMapMtx.unlock();
     // If not a host pointer and no present modifier, we need to wait for the
     // event if it exists.
-    if (!IsHostPtr && !HasPresentModifier) {
+    // Note: Entry might be nullptr because of zero length array section.
+    if (Entry != HostDataToTargetListTy::iterator() && !IsHostPtr &&
+        !HasPresentModifier) {
       Entry->lock();
       void *Event = Entry->getEvent();
       if (Event) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116716.397780.patch
Type: text/x-patch
Size: 646 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220106/de317076/attachment.bin>


More information about the Openmp-commits mailing list