ocl-icd-2.3.2-6.fc41

List of Defects

Error: GCC_ANALYZER_WARNING: [#def1]
ocl-icd-2.3.2-build/ocl-icd-2.3.2/cllayerinfo.c: scope_hint: In function ‘silence_fd’
ocl-icd-2.3.2-build/ocl-icd-2.3.2/cllayerinfo.c:16:3: warning[-Wanalyzer-fd-use-without-check]: ‘dup2’ on possibly invalid file descriptor ‘open("/dev/null", 1)’
#   14|     fd_bak = dup(fd);
#   15|     new_fd = open("/dev/null", O_WRONLY);
#   16|->   dup2(new_fd, fd);
#   17|     close(new_fd);
#   18|     return fd_bak;

Error: CLANG_WARNING: [#def2]
ocl-icd-2.3.2-build/ocl-icd-2.3.2/libdummy_icd.c:258:9: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull'
#  256|   		char* strnb=getenv(ENVNAME);
#  257|   		if (strnb) {
#  258|-> 			*res=atoi(getenv(ENVNAME));
#  259|   		} else {
#  260|   			*res=0;

Error: CPPCHECK_WARNING: [#def3]
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-688): [#def4]
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c: scope_hint: In function '_open_driver'
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c:236:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'lib_path' where non-null expected
/usr/include/CL/opencl.h:25: included_from: Included from here.
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c:49: included_from: Included from here.
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c: scope_hint: In function '_open_driver'
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c:56: included_from: Included from here.
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c:846:5: note: in expansion of macro 'debug'
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c: scope_hint: In function '_open_driver'
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c: scope_hint: In function '_open_driver'
<built-in>: note: argument 1 of '__builtin_sprintf' must be non-null
#  234|       lib_path_length = strlen(dir_path) + strlen(file_path) + 2;
#  235|       lib_path = malloc(lib_path_length*sizeof(char));
#  236|->     sprintf(lib_path,"%s/%s", dir_path, file_path);
#  237|     } else {
#  238|       lib_path_length = strlen(file_path) + 1;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def5]
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c: scope_hint: In function ‘_open_driver’
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c:236:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘lib_path’ where non-null expected
/usr/include/CL/opencl.h:25: included_from: Included from here.
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c:49: included_from: Included from here.
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c: scope_hint: In function ‘_open_driver’
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c:56: included_from: Included from here.
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c:846:5: note: in expansion of macro ‘debug’
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c: scope_hint: In function ‘_open_driver’
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c: scope_hint: In function ‘_open_driver’
<built-in>: note: argument 1 of ‘__builtin_sprintf’ must be non-null
#  234|       lib_path_length = strlen(dir_path) + strlen(file_path) + 2;
#  235|       lib_path = malloc(lib_path_length*sizeof(char));
#  236|->     sprintf(lib_path,"%s/%s", dir_path, file_path);
#  237|     } else {
#  238|       lib_path_length = strlen(file_path) + 1;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def6]
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c:240:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'lib_path' where non-null expected
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c: scope_hint: In function '_open_driver'
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c:846:5: note: in expansion of macro 'debug'
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c: scope_hint: In function '_open_driver'
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c: scope_hint: In function '_open_driver'
<built-in>: note: argument 1 of '__builtin_sprintf' must be non-null
#  238|       lib_path_length = strlen(file_path) + 1;
#  239|       lib_path = malloc(lib_path_length*sizeof(char));
#  240|->     sprintf(lib_path,"%s", file_path);
#  241|     }
#  242|     debug(D_LOG, "Considering file '%s'", lib_path);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def7]
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c:240:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘lib_path’ where non-null expected
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c: scope_hint: In function ‘_open_driver’
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c:846:5: note: in expansion of macro ‘debug’
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c: scope_hint: In function ‘_open_driver’
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c: scope_hint: In function ‘_open_driver’
<built-in>: note: argument 1 of ‘__builtin_sprintf’ must be non-null
#  238|       lib_path_length = strlen(file_path) + 1;
#  239|       lib_path = malloc(lib_path_length*sizeof(char));
#  240|->     sprintf(lib_path,"%s", file_path);
#  241|     }
#  242|     debug(D_LOG, "Considering file '%s'", lib_path);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def8]
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c:266:21: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'lib_path' where non-null expected
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c: scope_hint: In function '_open_driver'
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c:846:5: note: in expansion of macro 'debug'
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c: scope_hint: In function '_open_driver'
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c: scope_hint: In function '_open_driver'
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c:30: included_from: Included from here.
/usr/include/string.h:413:15: note: argument 1 of 'strnlen' must be non-null
#  264|     }
#  265|   
#  266|->   lib_path_length = strnlen(lib_path, lib_path_length);
#  267|   
#  268|     if( lib_path[lib_path_length-1] == '\n' )

Error: GCC_ANALYZER_WARNING (CWE-688): [#def9]
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c:266:21: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘lib_path’ where non-null expected
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c: scope_hint: In function ‘_open_driver’
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c:846:5: note: in expansion of macro ‘debug’
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c: scope_hint: In function ‘_open_driver’
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c: scope_hint: In function ‘_open_driver’
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c:30: included_from: Included from here.
/usr/include/string.h:413:15: note: argument 1 of ‘strnlen’ must be non-null
#  264|     }
#  265|   
#  266|->   lib_path_length = strnlen(lib_path, lib_path_length);
#  267|   
#  268|     if( lib_path[lib_path_length-1] == '\n' )

Error: CPPCHECK_WARNING (CWE-401): [#def10]
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c:321: error[memleakOnRealloc]: Common realloc mistake: '_picds' nulled but not freed upon failure
#  319|       } else {
#  320|         req = req - (allocated - _num_picds);
#  321|->       _picds=(struct platform_icd*)realloc(_picds, (allocated+req)*sizeof(struct platform_icd));
#  322|       }
#  323|       allocated += req;

Error: CPPCHECK_WARNING (CWE-401): [#def11]
ocl-icd-2.3.2-build/ocl-icd-2.3.2/ocl_icd_loader.c:896: error[memleakOnRealloc]: Common realloc mistake: '_icds' nulled but not freed upon failure
#  894|   
#  895|     if (_num_icds < num_icds) {
#  896|->     _icds = (struct vendor_icd*)realloc(_icds, _num_icds * sizeof(struct vendor_icd));
#  897|     }
#  898|     debug(D_WARN, "%d valid vendor(s)!", _num_icds);

Error: CLANG_WARNING: [#def12]
ocl-icd-2.3.2-build/ocl-icd-2.3.2/run_dummy_icd.c:72:7: warning[unix.Malloc]: Potential leak of memory pointed to by 'platforms'
#   70|        free(platform_vendor);
#   71|     }
#   72|->   if( chosen_platform == NULL ) {
#   73|       fprintf(stderr,"Error LIG platform not found!\n");
#   74|       return -1;

Scan Properties

analyzer-version-clang18.1.7
analyzer-version-cppcheck2.14.2
analyzer-version-gcc14.1.1
analyzer-version-gcc-analyzer14.1.1
analyzer-version-shellcheck0.10.0
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-21.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-nameocl-icd-2.3.2-6.fc41
store-results-to/tmp/tmp0mvv55xg/ocl-icd-2.3.2-6.fc41.tar.xz
time-created2024-07-03 16:25:47
time-finished2024-07-03 16:27:02
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmp0mvv55xg/ocl-icd-2.3.2-6.fc41.tar.xz' '--gcc-analyze' '/tmp/tmp0mvv55xg/ocl-icd-2.3.2-6.fc41.src.rpm'
tool-versioncsmock-3.5.3-1.el9