Skip to content

Klocwork check null before dereference in acl_svm.cpp #206

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 1 commit into from
Nov 22, 2022

Conversation

haoxian2
Copy link
Contributor

Fixed the following Klocwork issue:

  1. Pointer 'context->svm_list' returned from call to function 'malloc' at line 147 may be NULL and will be dereferenced at line 149.
    Verifying that malloc appropriately allocated the memory. The size of malloc is not user defined, therefore an assert is more appropriate.

@pcolberg
Copy link
Contributor

Klocwork issues resolved in commit d845c2b:

---------------------------------------------------------------------------
124 (Local) /__w/fpga-runtime-for-opencl/fpga-runtime-for-opencl/src/acl_svm.cpp:149 NPD.FUNC.MUST (1:Critical) Analyze
Pointer 'context->svm_list' returned from call to function 'malloc' at line 147 may be NULL and will be dereferenced at line 149.
  * acl_svm.cpp:147: 'context->svm_list' is assigned the return value from function 'malloc'.
  * acl_svm.cpp:149: 'context->svm_list' is explicitly dereferenced.
Current status 'Analyze'

Summary: 1 Local
1 Total Issue(s)

@pcolberg pcolberg merged commit 33ef809 into intel:main Nov 22, 2022
@haoxian2 haoxian2 deleted the klocwork-acl-svm branch November 22, 2022 20:05
@pcolberg pcolberg added this to the 2023.1 milestone Nov 23, 2022
@pcolberg pcolberg added the bug Something isn't working label Nov 30, 2022
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.

2 participants