-
Notifications
You must be signed in to change notification settings - Fork 30
Fix problems in dpctl identified with Klockwork static code analysis #186
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
Fix problems in dpctl identified with Klockwork static code analysis #186
Conversation
@@ -148,7 +148,12 @@ size_t DPPLPlatform_GetNumNonHostPlatforms () | |||
|
|||
size_t DPPLPlatform_GetNumNonHostBackends () | |||
{ | |||
return get_set_of_non_hostbackends().size(); | |||
auto be_set = get_set_of_non_hostbackends(); |
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.
What was the problem?
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.
Non-void function does not return value
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.
return get_set_of_non_hostbackends().size();
does not return value? How it is possible?
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.
The value should be returned, but at this point klocwork shows a warning
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.
Weird that klockwork requires this change, but if it fixes the warning then I am OK with this 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.
Are there only these two changes? If so, we can merge this and silence the memory leak warning using @vlad-perevezentsev's idea.
@@ -148,7 +148,12 @@ size_t DPPLPlatform_GetNumNonHostPlatforms () | |||
|
|||
size_t DPPLPlatform_GetNumNonHostBackends () | |||
{ | |||
return get_set_of_non_hostbackends().size(); | |||
auto be_set = get_set_of_non_hostbackends(); |
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.
Weird that klockwork requires this change, but if it fixes the warning then I am OK with this change.
@diptorupd we need to get new Klockwork results from CI. |
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.
LGTM. Will see next Klokwork results after merge.
https://jira.devtools.intel.com/browse/SAT-3619
An up - to-date analysis of the klocwork master branch showed 3 warnings. 2 match the previous analysis and have been corrected. Warning memory leak is unchanged because it was created deliberately(Sergey Pokhodenko).
The memory leak warning is still displayed in the klocwork report. I don't know what to do with it. klocwork does not support comments in the code for skipping analysis. You can add a key to build the report table so that the warning is not displayed in the table.