-
Notifications
You must be signed in to change notification settings - Fork 70
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
Cherry pick Coverity fixes to release #380
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fixes: ``` lib/pkg_editor/test/pkg_editor_test.cpp:468:29: Type: Variable copied when it could be moved (COPY_INSTEAD_OF_MOVE) src/acl_auto_configure.cpp:405:32: Type: Variable copied when it could be moved (COPY_INSTEAD_OF_MOVE) src/acl_auto_configure.cpp:430:7: Type: Variable copied when it could be moved (COPY_INSTEAD_OF_MOVE) src/acl_auto_configure.cpp:437:7: Type: Variable copied when it could be moved (COPY_INSTEAD_OF_MOVE) src/acl_auto_configure.cpp:438:7: Type: Variable copied when it could be moved (COPY_INSTEAD_OF_MOVE) src/acl_auto_configure.cpp:439:7: Type: Variable copied when it could be moved (COPY_INSTEAD_OF_MOVE) src/acl_auto_configure.cpp:493:5: Type: Variable copied when it could be moved (COPY_INSTEAD_OF_MOVE) src/acl_auto_configure.cpp:498:30: Type: Variable copied when it could be moved (COPY_INSTEAD_OF_MOVE) src/acl_auto_configure.cpp:886:7: Type: Variable copied when it could be moved (COPY_INSTEAD_OF_MOVE) src/acl_auto_configure.cpp:896:7: Type: Variable copied when it could be moved (COPY_INSTEAD_OF_MOVE) src/acl_auto_configure.cpp:900:7: Type: Variable copied when it could be moved (COPY_INSTEAD_OF_MOVE) src/acl_auto_configure.cpp:901:7: Type: Variable copied when it could be moved (COPY_INSTEAD_OF_MOVE) src/acl_auto_configure.cpp:903:7: Type: Variable copied when it could be moved (COPY_INSTEAD_OF_MOVE) src/acl_hal_mmd.cpp:2945:40: Type: Variable copied when it could be moved (COPY_INSTEAD_OF_MOVE) src/acl_program.cpp:1375:5: Type: Variable copied when it could be moved (COPY_INSTEAD_OF_MOVE) src/acl_usm.cpp:170:9: Type: Variable copied when it could be moved (COPY_INSTEAD_OF_MOVE) ``` (cherry picked from commit 5b5081a)
Fixes: ``` test/acl_auto_configure_test.cpp:285:3: Type: Using invalid iterator (INVALIDATE_ITERATOR) test/acl_auto_configure_test.cpp:285:3: 124. deref_iterator: Dereferencing iterator "kernel15_dev_global" though it is already past the end of its container. test/acl_auto_configure_test.cpp:292:3: Type: Using invalid iterator (INVALIDATE_ITERATOR) test/acl_auto_configure_test.cpp:292:3: 136. deref_iterator: Dereferencing iterator "kernel15_dev_global2" though it is already past the end of its container. ``` (cherry picked from commit 7201bb2)
Fixes: ``` lib/pkg_editor/src/pkg_editor.c:1486:5: Type: Resource leak (RESOURCE_LEAK) lib/pkg_editor/src/pkg_editor.c:1468:3: 1. path: Condition "of == NULL", taking false branch. lib/pkg_editor/src/pkg_editor.c:1480:3: 2. alloc_arg: "deflateInit_" allocates memory that is stored into "z_info.strm.state". lib/pkg_editor/src/pkg_editor.c:1482:3: 3. path: Condition "ret != 0", taking true branch. lib/pkg_editor/src/pkg_editor.c:1486:5: 4. leaked_storage: Variable "z_info" going out of scope leaks the storage "z_info.strm.state" points to. ``` (cherry picked from commit 15f1e3a)
Fixes: ``` lib/acl_threadsupport/test/acl_threadsupport_test.cpp:111:5: Type: Check of thread-shared field evades lock acquisition (LOCK_EVASION) lib/acl_threadsupport/test/acl_threadsupport_test.cpp:106:9: 1. thread1_checks_field: Thread1 uses the value read from static field "threadtest_state" in the condition "threadtest_state == 2". It sees that the condition is false. Control is switched to Thread2. lib/acl_threadsupport/test/acl_threadsupport_test.cpp:106:9: 2. thread2_checks_field: Thread2 uses the value read from static field "threadtest_state" in the condition "threadtest_state == 2". It sees that the condition is false. lib/acl_threadsupport/test/acl_threadsupport_test.cpp:110:5: 3. thread2_acquires_lock: Thread2 acquires lock "mymutex". lib/acl_threadsupport/src/acl_threadsupport.c:100:42: 3.1. lock: "pthread_mutex_lock" locks "mutex". lib/acl_threadsupport/test/acl_threadsupport_test.cpp:111:5: 4. thread2_modifies_field: Thread2 sets "threadtest_state" to a new value. Note that this write can be reordered at runtime to occur before instructions that do not access this field within this locked region. After Thread2 leaves the critical section, control is switched back to Thread1. lib/acl_threadsupport/test/acl_threadsupport_test.cpp:110:5: 5. thread1_acquires_lock: Thread1 acquires lock "mymutex". lib/acl_threadsupport/src/acl_threadsupport.c:100:42: 5.1. lock: "pthread_mutex_lock" locks "mutex". lib/acl_threadsupport/test/acl_threadsupport_test.cpp:111:5: 6. thread1_overwrites_value_in_field: Thread1 sets "threadtest_state" to a new value. Now the two threads have an inconsistent view of "threadtest_state" and updates to fields correlated with "threadtest_state" may be lost. lib/acl_threadsupport/test/acl_threadsupport_test.cpp:106:9: 7. use_same_locks_for_read_and_modify: Guard the modification of "threadtest_state" and the read used to decide whether to modify "threadtest_state" with the same set of locks. ``` (cherry picked from commit 10bd4e6)
Fixes: ``` include/acl_thread.h:121:7: Type: Rule of three (RULE_OF_ZERO_THREE_FIVE) include/acl_thread.h:121:7: rule_of_three_violation: Class "acl_suspend_lock_guard" has a user definition for at least one special function (copy constructor, copy assignment, destructor) but not all. If one of these functions requires a user definition then the others likely do as well. include/acl_thread.h:121:7: remediation: Add user-definition for a copy constructor. include/acl_thread.h:121:7: remediation: Add user-definition for a copy assignment operator. include/acl_thread.h:126:3: destructor: User-defined destructor. include/acl_types.h:362:7: Type: Rule of three (RULE_OF_ZERO_THREE_FIVE) include/acl_types.h:362:7: rule_of_three_violation: Class "acl_device_program_info_t" has a user definition for at least one special function (copy constructor, copy assignment, destructor) but not all. If one of these functions requires a user definition then the others likely do as well. include/acl_types.h:362:7: remediation: Add user-definition for a copy constructor. include/acl_types.h:362:7: remediation: Add user-definition for a copy assignment operator. src/acl_device_program_info.cpp:29:28: destructor: User-defined destructor. ```
This also aligns with CppUTest change cpputest/cpputest@37735cc Fixes: ``` lib/CppUTest/include/CppUTest/Failure.h:72:7: Type: Rule of three (RULE_OF_ZERO_THREE_FIVE) lib/CppUTest/include/CppUTest/Failure.h:72:7: rule_of_three_violation: Class "EqualsFailure" has a user definition for at least one special function (copy constructor, copy assignment, destructor) but not all. If one of these functions requires a user definition then the others likely do as well. lib/CppUTest/include/CppUTest/Failure.h:80:2: copy_ctor: User-defined copy constructor. lib/CppUTest/include/CppUTest/Failure.h:81:17: copy_assign: User-defined copy assignment operator. lib/CppUTest/include/CppUTest/Failure.h:72:7: remediation: Add user-definition for a destructor. ``` (cherry picked from commit 9a3204e)
Also this is only test code. (cherry picked from commit 3f0291b)
mendell27
approved these changes
Aug 28, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.