-
Notifications
You must be signed in to change notification settings - Fork 848
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 coverity scan logically dead code #6451
Fix coverity scan logically dead code #6451
Conversation
@erimatnor, @mkindahl: please review this pull request.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6451 +/- ##
==========================================
- Coverage 87.33% 87.33% -0.01%
==========================================
Files 187 187
Lines 41846 41793 -53
Branches 9314 9292 -22
==========================================
- Hits 36545 36498 -47
+ Misses 3626 3620 -6
Partials 1675 1675 ☔ View full report in Codecov by Sentry. |
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.
Added a comment that should be checked before merging. The rest looks good to me.
@@ -146,9 +139,6 @@ cagg_rebuild_view_definition(ContinuousAgg *agg, Hypertable *mat_ht, bool force_ | |||
&mataddress, | |||
NameStr(mat_ht->fd.table_name)); | |||
} | |||
else | |||
view_query = | |||
finalizequery_get_select_query(&fqi, mattblinfo.matcollist, &mataddress, relname); |
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.
I am wondering what happens in this case: Since we now remove the else statement, view_query
could be uninitialized in line 149. If !agg->data.materialized_only
in line 153 is also false, the variable stays uninitialized and we will access the NULL
pointer in line 181.
Even if the condition is true, passing the uninitialized view_query
to build_union_query
looks suspicious. However, our test cases do not fail and these branches are marked as dead code. But could you double-check that this is not a problem before merging?
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.
It will not happen because in the current logic the only way to this happen is if the finalized=false
and in that case we are exiting earlier of the function emitting a warning message.
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.
Anyway removed the branch because it become useless at this point.
b2d5f2c
to
a189989
Compare
Automated backport to 2.13.x not done: cherry-pick failed. Git status
|
https://scan4.scan.coverity.com/reports.htm#v54116/p12995/fileInstanceId=143855089&defectInstanceId=14714889&mergedDefectId=384044 https://scan4.scan.coverity.com/reports.htm#v54116/p12995/fileInstanceId=143855089&defectInstanceId=14714890&mergedDefectId=378576
Disable-check: force-changelog-file