Skip to content

Commit

Permalink
address remaining codeql issues (#48)
Browse files Browse the repository at this point in the history
* address remaining codeql issues
* corrected cmake options for CI actions
  • Loading branch information
brtnfld authored Dec 10, 2024
1 parent 57a6a26 commit f53805b
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 13 deletions.
23 changes: 17 additions & 6 deletions .github/codeql-config.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
# Query filters to include or exclude specific queries
query-filters:
- exclude:
id: 3rdparty
- exclude:
id: cpp/toctou-race-condition
- exclude:
# See: https://codeql.github.com/codeql-query-help/cpp/cpp-short-global-name/
id: cpp/short-global-name
- exclude:
# See: https://codeql.github.com/codeql-query-help/cpp/cpp-commented-out-code/
id: cpp/commented-out-code
- exclude:
# See: https://codeql.github.com/codeql-query-help/cpp/cpp-poorly-documented-function/
id: cpp/poorly-documented-function
- exclude:
# See: https://codeql.github.com/codeql-query-help/cpp/cpp-trivial-switch/
id: cpp/trivial-switch
- exclude:
# See: https://codeql.github.com/codeql-query-help/cpp/cpp-irregular-enum-init/
id: cpp/irregular-enum-init

# Directories to scan for vulnerabilities
paths:
- 'src'
- src # Main source directory

# Directories and files to ignore during the scan
paths-ignore:
- 'test'
- test # Test directory

2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=$HDF5_DIR -DHDF5_ENABLE_PARALLEL=ON -DHDF5_ENABLE_THREADSAFE=ON \
-DALLOW_UNSUPPORTED=ON -DBUILD_TESTING=OFF -DHDF5_BUILD_HL_LIB=OFF \
-DHDF5_ALLOW_UNSUPPORTED=ON -DBUILD_TESTING=OFF -DHDF5_BUILD_HL_LIB=OFF \
-DHDF5_BUILD_EXAMPLES=OFF -DHDF5_BUILD_FORTRAN=OFF -DCMAKE_C_COMPILER=mpicc ..
make -j && make install
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ jobs:
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=$HDF5_DIR -DHDF5_ENABLE_PARALLEL=ON -DHDF5_ENABLE_THREADSAFE=ON \
-DALLOW_UNSUPPORTED=ON -DBUILD_TESTING=OFF -DHDF5_BUILD_HL_LIB=OFF \
-DHDF5_ALLOW_UNSUPPORTED=ON -DBUILD_TESTING=OFF -DHDF5_BUILD_HL_LIB=OFF \
-DHDF5_BUILD_EXAMPLES=OFF -DHDF5_BUILD_FORTRAN=OFF -DCMAKE_C_COMPILER=mpicc ..
make -j && make install
Expand Down Expand Up @@ -226,7 +226,7 @@ jobs:
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=$HDF5_DIR -DHDF5_ENABLE_PARALLEL=ON -DHDF5_ENABLE_THREADSAFE=ON \
-DALLOW_UNSUPPORTED=ON -DBUILD_TESTING=OFF -DHDF5_BUILD_HL_LIB=OFF \
-DHDF5_ALLOW_UNSUPPORTED=ON -DBUILD_TESTING=OFF -DHDF5_BUILD_HL_LIB=OFF \
-DHDF5_BUILD_EXAMPLES=OFF -DHDF5_BUILD_FORTRAN=OFF -DCMAKE_C_COMPILER=mpicc ..
make -j && make install
Expand Down Expand Up @@ -311,7 +311,7 @@ jobs:
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=$HDF5_DIR -DHDF5_ENABLE_PARALLEL=ON -DHDF5_ENABLE_THREADSAFE=ON \
-DALLOW_UNSUPPORTED=ON -DBUILD_TESTING=OFF -DHDF5_BUILD_HL_LIB=OFF \
-DHDF5_ALLOW_UNSUPPORTED=ON -DBUILD_TESTING=OFF -DHDF5_BUILD_HL_LIB=OFF \
-DHDF5_BUILD_EXAMPLES=OFF -DHDF5_BUILD_FORTRAN=OFF -DCMAKE_C_COMPILER=mpicc ..
make -j && make install
Expand Down
25 changes: 22 additions & 3 deletions src/h5_async_vol.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ works, and perform publicly and display publicly, and to permit others to do so.
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <time.h>

#ifdef ENABLE_WRITE_MEMCPY
Expand Down Expand Up @@ -1431,14 +1432,25 @@ async_instance_init(int backing_thread_count)
char fname[128];
sprintf(fname, "async.log.%d", aid->mpi_rank);
fout_g = fopen(fname, "w");
if (fout_g == NULL) {
int fd = open(fname, O_WRONLY | O_CREAT, S_IWUSR | S_IRUSR | S_IRGRP);
if (fd < 0) {
fprintf(fout_g, " [ASYNC VOL ERROR] with opening %s\n", fname);
free(progress_xstreams);
free(progress_scheds);
free(aid);
hg_ret = -1;
goto done;
}
fout_g = fdopen(fd, "w");
if (fout_g == NULL) {
fprintf(fout_g, " [ASYNC VOL ERROR] with fopen for %s\n", fname);
close(fd);
free(progress_xstreams);
free(progress_scheds);
free(aid);
hg_ret = -1;
goto done;
}
}
done:
abt_ret = ABT_mutex_unlock(async_instance_mutex_g);
Expand All @@ -1453,7 +1465,10 @@ async_instance_init(int backing_thread_count)
return -1;
}

func_log(__func__, "success");
if (hg_ret == -1)
func_log(__func__, "failed");
else
func_log(__func__, "success");

return hg_ret;
} // End async_instance_init
Expand Down Expand Up @@ -20024,7 +20039,11 @@ H5VL_async_wrap_object(void *obj, H5I_type_t obj_type, void *_wrap_ctx)
/* Wrap the object with the underlying VOL */
under = H5VLwrap_object(obj, obj_type, wrap_ctx->under_vol_id, wrap_ctx->under_wrap_ctx);
if (under) {
new_obj = H5VL_async_new_obj(under, wrap_ctx->under_vol_id);
if ((new_obj = H5VL_async_new_obj(under, wrap_ctx->under_vol_id)) == NULL) {
fprintf(fout_g, " [ASYNC VOL ERROR] %s with request object calloc\n", __func__);
return NULL;
}

new_obj->file_async_obj = wrap_ctx->file_async_obj;
}
else
Expand Down

0 comments on commit f53805b

Please sign in to comment.