Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

address remaining codeql issues #48

Merged
merged 6 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading