[Openmp-commits] [PATCH] D107348: [OpenMP][NFC] Cleanup: minor fixes to silence static analyzer.
Andrey Churbanov via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Mon Aug 16 03:39:39 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG52cac541d431: [OpenMP] libomp: cleanup: minor fixes to silence static analyzer. (authored by AndreyChurbanov).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107348/new/
https://reviews.llvm.org/D107348
Files:
openmp/runtime/src/kmp_affinity.cpp
openmp/runtime/src/kmp_alloc.cpp
openmp/runtime/src/kmp_dispatch.cpp
Index: openmp/runtime/src/kmp_dispatch.cpp
===================================================================
--- openmp/runtime/src/kmp_dispatch.cpp
+++ openmp/runtime/src/kmp_dispatch.cpp
@@ -668,6 +668,8 @@
case kmp_sch_static_chunked:
case kmp_sch_dynamic_chunked:
dynamic_init:
+ if (tc == 0)
+ break;
if (pr->u.p.parm1 <= 0)
pr->u.p.parm1 = KMP_DEFAULT_CHUNK;
else if (pr->u.p.parm1 > tc)
Index: openmp/runtime/src/kmp_alloc.cpp
===================================================================
--- openmp/runtime/src/kmp_alloc.cpp
+++ openmp/runtime/src/kmp_alloc.cpp
@@ -883,7 +883,7 @@
__kmp_bget_dequeue(th); /* Release any queued buffers */
#ifdef SizeQuant
- len &= ~(SizeQuant - 1);
+ len &= ~((bufsize)(SizeQuant - 1));
#endif
if (thr->pool_len == 0) {
thr->pool_len = len;
Index: openmp/runtime/src/kmp_affinity.cpp
===================================================================
--- openmp/runtime/src/kmp_affinity.cpp
+++ openmp/runtime/src/kmp_affinity.cpp
@@ -2386,7 +2386,10 @@
unsigned val;
if ((p == NULL) || (KMP_SSCANF(p + 1, "%u\n", &val) != 1))
goto no_val;
- KMP_ASSERT(nodeIdIndex + level <= maxIndex);
+ // validate the input before using level:
+ if (level > (unsigned)__kmp_xproc) { // level is too big
+ level = __kmp_xproc;
+ }
if (threadInfo[num_avail][nodeIdIndex + level] != UINT_MAX)
goto dup_field;
threadInfo[num_avail][nodeIdIndex + level] = val;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107348.366582.patch
Type: text/x-patch
Size: 1540 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210816/de1fb40a/attachment.bin>
More information about the Openmp-commits
mailing list