Skip to content

Klocwork check null before dereference in acl_kernel_if #43

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 7 commits into from
Dec 14, 2021

Conversation

sherry-yuan
Copy link
Contributor

Fix the following klocwork issues in acl_kernel_if.cpp:

  1. Pointer 'kern->accel_csr' returned from call to function 'acl_malloc' at line 875 may be NULL and may be dereferenced at line 886.
  2. Pointer 'kern->accel_perf_mon' returned from call to function 'acl_malloc' at line 877 may be NULL and may be dereferenced at line 898.
  3. Pointer 'kern->accel_num_printfs' returned from call to function 'acl_malloc' at line 879 may be NULL and may be dereferenced at line 908.
  4. Pointer 'kern->accel_job_ids' returned from call to function 'acl_malloc' at line 947 may be NULL and will be dereferenced at line 962.
  5. Pointer 'kern->accel_queue_front' returned from call to function 'acl_malloc' at line 954 may be NULL and will be dereferenced at line 964.
  6. Pointer 'kern->accel_invoc_queue_depth' returned from call to function 'acl_malloc' at line 949 may be NULL and will be dereferenced at line 961.
  7. Pointer 'kern->accel_queue_back' returned from call to function 'acl_malloc' at line 955 may be NULL and will be dereferenced at line 965.

@sherry-yuan sherry-yuan self-assigned this Dec 14, 2021
@sherry-yuan sherry-yuan added the bug Something isn't working label Dec 14, 2021
@sherry-yuan sherry-yuan added this to the 2022.2 milestone Dec 14, 2021
@sherry-yuan sherry-yuan marked this pull request as ready for review December 14, 2021 18:53
@sherry-yuan sherry-yuan requested a review from pcolberg December 14, 2021 18:53
Copy link
Contributor

@pcolberg pcolberg left a comment

Choose a reason for hiding this comment

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

Thanks @sherry-yuan! I would suggest to simply go with assert().

Pointer 'kern->accel_csr' returned from call to function 'acl_malloc' at line 875 may be NULL and may be dereferenced at line 886.
Pointer 'kern->accel_perf_mon' returned from call to function 'acl_malloc' at line 877 may be NULL and may be dereferenced at line 898.
Pointer 'kern->accel_num_printfs' returned from call to function 'acl_malloc' at line 879 may be NULL and may be dereferenced at line 908.
Pointer 'kern->accel_job_ids' returned from call to function 'acl_malloc' at line 947 may be NULL and will be dereferenced at line 962.
…encing

Pointer 'kern->accel_invoc_queue_depth' returned from call to function 'acl_malloc' at line 949 may be NULL and will be dereferenced at line 961.
Pointer 'kern->accel_queue_front' returned from call to function 'acl_malloc' at line 954 may be NULL and will be dereferenced at line 964
Pointer 'kern->accel_queue_back' returned from call to function 'acl_malloc' at line 955 may be NULL and will be dereferenced at line 965
@pcolberg pcolberg force-pushed the klocwork_null_deref branch from 2c61ca9 to e0a017b Compare December 14, 2021 21:29
@pcolberg pcolberg merged commit cfac76e into intel:main Dec 14, 2021
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