[Mlir-commits] [mlir] 586ce6a - [MLIR][NFC] Fix a memset in MemRefUtils.h

Shivam Gupta llvmlistbot at llvm.org
Mon Jan 23 01:45:02 PST 2023


Author: Shivam Gupta
Date: 2023-01-23T15:15:30+05:30
New Revision: 586ce6ac9e45c736923f105530a51017c518c82f

URL: https://github.com/llvm/llvm-project/commit/586ce6ac9e45c736923f105530a51017c518c82f
DIFF: https://github.com/llvm/llvm-project/commit/586ce6ac9e45c736923f105530a51017c518c82f.diff

LOG: [MLIR][NFC] Fix a memset in MemRefUtils.h

found by PVS-Studio - https://pvs-studio.com/en/blog/posts/cpp/1003/, N10.
memset function expects to take int as the second actual argument,
but receives a pointer. Here, the first and the second argument of
the function are mixed up.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D142310

Added: 
    

Modified: 
    mlir/include/mlir/ExecutionEngine/MemRefUtils.h

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/ExecutionEngine/MemRefUtils.h b/mlir/include/mlir/ExecutionEngine/MemRefUtils.h
index 55369c734732a..918647d9feac3 100644
--- a/mlir/include/mlir/ExecutionEngine/MemRefUtils.h
+++ b/mlir/include/mlir/ExecutionEngine/MemRefUtils.h
@@ -191,7 +191,7 @@ class OwningMemRef {
     freeFunc = other.freeFunc;
     descriptor = other.descriptor;
     other.freeFunc = nullptr;
-    memset(0, &other.descriptor, sizeof(other.descriptor));
+    memset(&other.descriptor, 0, sizeof(other.descriptor));
   }
   OwningMemRef(OwningMemRef &&other) { *this = std::move(other); }
 


        


More information about the Mlir-commits mailing list