aboutsummaryrefslogtreecommitdiff
path: root/openmp
diff options
context:
space:
mode:
authorJoachim Jenke <jenke@itc.rwth-aachen.de>2023-07-07 13:58:38 +0200
committerJoachim Jenke <jenke@itc.rwth-aachen.de>2023-07-07 14:01:39 +0200
commit94ec99752112e42dad54588d800d99bc2ee0dfb0 (patch)
tree42060e89a8368cd1d2b5fbba37fdd3695d212cda /openmp
parent36f67434f724f2cdf36735b243fdaace726afb85 (diff)
downloadllvm-94ec99752112e42dad54588d800d99bc2ee0dfb0.zip
llvm-94ec99752112e42dad54588d800d99bc2ee0dfb0.tar.gz
llvm-94ec99752112e42dad54588d800d99bc2ee0dfb0.tar.bz2
[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
Diffstat (limited to 'openmp')
-rw-r--r--openmp/tools/multiplex/ompt-multiplex.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/openmp/tools/multiplex/ompt-multiplex.h b/openmp/tools/multiplex/ompt-multiplex.h
index 041b152..ec72aab 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);