[Openmp-commits] [openmp] 94ec997 - [OpenMP][OMPT] Add two missing nullpointer checks in ompt-multiplex.h
Joachim Jenke via Openmp-commits
openmp-commits at lists.llvm.org
Fri Jul 7 05:01:47 PDT 2023
Author: Joachim Jenke
Date: 2023-07-07T14:01:39+02:00
New Revision: 94ec99752112e42dad54588d800d99bc2ee0dfb0
URL: https://github.com/llvm/llvm-project/commit/94ec99752112e42dad54588d800d99bc2ee0dfb0
DIFF: https://github.com/llvm/llvm-project/commit/94ec99752112e42dad54588d800d99bc2ee0dfb0.diff
LOG: [OpenMP][OMPT] Add two missing nullpointer checks in ompt-multiplex.h
In the functions ompt_multiplex_get_own_ompt_data
and ompt_multiplex_get_client_ompt_data in addition to
data being NULL, also the void pointer field "ptr" of
"data" could be NULL, leading to a subsequent
segfault.
This patch add the corresponding checks.
Patch prepared by Semih Burak
Differential Revision: https://reviews.llvm.org/D112806
Added:
Modified:
openmp/tools/multiplex/ompt-multiplex.h
Removed:
################################################################################
diff --git a/openmp/tools/multiplex/ompt-multiplex.h b/openmp/tools/multiplex/ompt-multiplex.h
index 041b15233c6b0d..ec72aab21ecb36 100644
--- a/openmp/tools/multiplex/ompt-multiplex.h
+++ b/openmp/tools/multiplex/ompt-multiplex.h
@@ -142,6 +142,8 @@ static void ompt_multiplex_free_data_pair(ompt_data_t *data_pointer) {
static ompt_data_t *ompt_multiplex_get_own_ompt_data(ompt_data_t *data) {
if (!data)
return NULL;
+ if (!data->ptr)
+ return NULL;
ompt_multiplex_data_pair_t *data_pair =
(ompt_multiplex_data_pair_t *)data->ptr;
return &(data_pair->own_data);
@@ -150,6 +152,8 @@ static ompt_data_t *ompt_multiplex_get_own_ompt_data(ompt_data_t *data) {
static ompt_data_t *ompt_multiplex_get_client_ompt_data(ompt_data_t *data) {
if (!data)
return NULL;
+ if (!data->ptr)
+ return NULL;
ompt_multiplex_data_pair_t *data_pair =
(ompt_multiplex_data_pair_t *)data->ptr;
return &(data_pair->client_data);
More information about the Openmp-commits
mailing list