Skip to content

Fixed coverity issues in acl_program.cpp #228

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

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.

@haoxian2 haoxian2 requested review from pcolberg and zibaiwan December 9, 2022 22:12
@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
@haoxian2 haoxian2 requested a review from zibaiwan January 12, 2023 15:09
@haoxian2 haoxian2 force-pushed the coverity-acl-program branch from 42c4afd to 6ae25c9 Compare January 17, 2023 21:06
@haoxian2 haoxian2 requested a review from zibaiwan January 17, 2023 21:07
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
@haoxian2 haoxian2 force-pushed the coverity-acl-program branch from 69cb093 to af9910e Compare January 18, 2023 21:40
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants