-
Notifications
You must be signed in to change notification settings - Fork 71
Klocwork check null before dereference in src/acl_kernel.cpp #202
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @haoxian2,
Thanks for working on this. The changes look fine to me. Can you please squash the commits so we don't have the "clang format" commit at the end?
Ideally you should have 3 commits in total, one for each issue. You can use git rebase -i
or other methods you prefer.
ef7a5a3
to
2cb96d2
Compare
@zibaiwan Made the change :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @haoxian2! These should be returned as errors to the user, as detailed below.
2cb96d2
to
30ec62f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @haoxian2 for the revision, I think we are almost there. I needed multiple passes as well to notice the fine details. Please see if you can verify the NULL pointer checks using the unit test as detailed below.
…r ensures that arg_value is not Null
…er_is_valid_ptr ensures pointer is not Null
30ec62f
to
6d2b722
Compare
As discussed offline with @haoxian2, this is pending on verifying that the test does indeed reach the desired code path(s). |
For the addition of
|
Klocwork issues resolved in commit a38e1da:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, thanks @haoxian2 for the investigation.
@zibaiwan This requires your approval to be merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed the following Klocwork issues:
acl_pipe_is_valid_pointer()
andacl_sampler_is_valid_ptr()
both returns 0 if arg_value is NULL, so thatis_sampler
andis_pipe
won't be updated to TRUE if arg_value is NULL. Therefore adding assert for both pipe_ptr and sampler.