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
cls/rgw: Initialization of uninitialized members #16932
Conversation
@@ -1045,7 +1045,7 @@ WRITE_CLASS_ENCODER(cls_rgw_gc_obj_info) | |||
|
|||
struct cls_rgw_lc_obj_head | |||
{ | |||
time_t start_date; | |||
time_t start_date = 0; |
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 depends on what date should be the start_date
. If it is the system's current date, then initialize with time(0);
. Please verify it.
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.
@joscollin Yes It looks.. It would be system's current time.
Why?
Since void encode(bufferlist& bl)
calls ::encode(t, bl);
with start_time, I believe encode would not start on 0, It would start on Current time.
But It would be good to take 2nd opinion from any other reviewer as well...
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.
@tchaikov Could you please take a look ?
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.
@tchaikov @joscollin Done Changes Thanks.
@joscollin Done changes.. |
Jenkins retest this please |
src/cls/rgw/cls_rgw_types.h
Outdated
@@ -1045,7 +1045,7 @@ WRITE_CLASS_ENCODER(cls_rgw_gc_obj_info) | |||
|
|||
struct cls_rgw_lc_obj_head | |||
{ | |||
time_t start_date; | |||
time_t start_date = time(0); |
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.
no point to get current time here. please just use 0
.
8917d3b
to
421be95
Compare
** 1396131 Uninitialized scalar field CID 1396131 (ceph#1 of 1): Uninitialized scalar field (UNINIT_CTOR) 2. uninit_member: Non-static class member max_entries is not initialized in this constructor nor in any functions that it calls. ** 1396125 Uninitialized scalar field CID 1396125 (ceph#1 of 1): Uninitialized scalar field (UNINIT_CTOR) 2. uninit_member: Non-static class member start_date is not initialized in this constructor nor in any functions that it calls. Signed-off-by: Amit Kumar amitkuma@redhat.com
@dang and @chenji-kael , could you help review this change? i failed to find the place where we set the |
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.
please hold until we understand where/when start_date
should be set.
@dang @chenji-kael Kindly have some time to look this PR.. |
start_date is set in https://github.com/ceph/ceph/blob/master/src/rgw/rgw_lc.cc#L197 and see https://github.com/ceph/ceph/blob/master/src/rgw/rgw_lc.cc#L642, But we currently have LC tests disabled in master due to frequent timing issues, #17020 is trying to fix that |
@theanalyst So What needed to be done now? |
thanks @theanalyst, but i am not qualified to approve this PR.
Fixes the coverity issues:
** 1396131 Uninitialized scalar field
** 1396125 Uninitialized scalar field
Signed-off-by: Amit Kumar amitkuma@redhat.com