Skip to content
New issue

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

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

Already on GitHub? # to your account

Fixed coverity issues in acl_program.cpp #228

Merged
merged 2 commits into from
Jan 19, 2023

Conversation

haoxian2
Copy link
Contributor

@haoxian2 haoxian2 commented Dec 9, 2022

Fixed coverity in acl_program.cpp: Dead default in switch (DEADCODE)

(line 256) Default branch never reached since switch (pass) only has 0 and 1 as values because pass is defined in a for-loop (line 225) as < 2.

Fixed coverity in acl_program.cpp: Dereference before null check (REVERSE_INULL)

(line 145) Program is already dereferenced in the for-loop above to check program->num_devices, so the check would also pass.

Fixed coverity in acl_program.cpp: Use after free (USE_AFTER_FREE)

(line 1834) Coverity complains that you should not print the pointer address value if it has already been freed. Since we are not accessing what's in the pointer itself, it is safe to query about pointer address value. Therefore, instead of passing the pointer as the argument, a dereferenced pointer to that pointer is passed as an argument instead.

@pcolberg pcolberg added the bug Something isn't working label Dec 10, 2022
@pcolberg pcolberg added this to the 2023.1 milestone Dec 10, 2022
@pcolberg pcolberg modified the milestones: 2023.1, 2023.2 Dec 23, 2022
src/acl_program.cpp Show resolved Hide resolved
src/acl_program.cpp Outdated Show resolved Hide resolved
src/acl_program.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@zibaiwan zibaiwan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @haoxian2! Looks good to me, can you please fix the clang format, then we can merge this!

zibaiwan
zibaiwan previously approved these changes Jan 18, 2023
Copy link
Contributor

@zibaiwan zibaiwan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @haoxian2 !

@zibaiwan zibaiwan merged commit 3e1c5ea into intel:main Jan 19, 2023
@haoxian2 haoxian2 deleted the coverity-acl-program branch January 19, 2023 15:43
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants