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
messages: Initialization of member variables #16898
Conversation
jenkins retest this please |
src/messages/MExportDirDiscover.h
Outdated
@@ -19,7 +19,7 @@ | |||
#include "include/types.h" | |||
|
|||
class MExportDirDiscover : public Message { | |||
mds_rank_t from; | |||
mds_rank_t from = 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.
0 has a meaning here, how about -1.
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.
Done..
src/messages/MDirUpdate.h
Outdated
@@ -19,10 +19,10 @@ | |||
#include "msg/Message.h" | |||
|
|||
class MDirUpdate : public Message { | |||
mds_rank_t from_mds; | |||
mds_rank_t from_mds = 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.
0 has MDS meaning
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.
Done..
src/messages/MDirUpdate.h
Outdated
int32_t dir_rep; | ||
int32_t discover; | ||
int32_t dir_rep = 0; | ||
int32_t discover = 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.
This is default-initialized to 5 below, maybe do that instead?
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.
Done..
src/messages/MDiscover.h
Outdated
@@ -29,8 +29,8 @@ class MDiscover : public Message { | |||
snapid_t snapid; | |||
filepath want; // ... [/]need/this/stuff | |||
|
|||
bool want_base_dir; | |||
bool want_xlocked; | |||
bool want_base_dir = false; |
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.
Defaults to true in the constructor; let's make them match.
aea509c
to
406348f
Compare
@gregsfortytwo Thanks for Comments, Review. Done Changes.. |
Fixes the coverity issues: ** 717271 Uninitialized scalar field 2. uninit_member: Non-static class member from_mds is not initialized in this constructor nor in any functions that it calls. 4. uninit_member: Non-static class member dir_rep is not initialized in this constructor nor in any functions that it calls. CID 717271 (ceph#1 of 1): Uninitialized scalar field (UNINIT_CTOR) 6. uninit_member: Non-static class member discover is not initialized in this constructor nor in any functions that it calls. ** 717272 Uninitialized scalar field 2. uninit_member: Non-static class member want_base_dir is not initialized in this constructor nor in any functions that it calls. CID 717272 (ceph#1 of 1): Uninitialized scalar field (UNINIT_CTOR) 4. uninit_member: Non-static class member want_xlocked is not initialized in this constructor nor in any functions that it calls. ** 717274 Uninitialized scalar field 2. uninit_member: Non-static class member wanted_base_dir is not initialized in this constructor nor in any functions that it calls. 4. uninit_member: Non-static class member wanted_xlocked is not initialized in this constructor nor in any functions that it calls. 6. uninit_member: Non-static class member flag_error_dn is not initialized in this constructor nor in any functions that it calls. 8. uninit_member: Non-static class member flag_error_dir is not initialized in this constructor nor in any functions that it calls. 10. uninit_member: Non-static class member unsolicited is not initialized in this constructor nor in any functions that it calls. 12. uninit_member: Non-static class member dir_auth_hint is not initialized in this constructor nor in any functions that it calls. CID 717274 (ceph#1 of 1): Uninitialized scalar field (UNINIT_CTOR) 14. uninit_member: Non-static class member starts_with is not initialized in this constructor nor in any functions that it calls. ** 717275 Uninitialized scalar field CID 717275 (ceph#1 of 1): Uninitialized scalar field (UNINIT_CTOR) 2. uninit_member: Non-static class member from is not initialized in this constructor nor in any functions that it calls. Signed-off-by: Amit Kumar amitkuma@redhat.com
Fixes the coverity issues:
** 717271 Uninitialized scalar field
** 717272 Uninitialized scalar field
** 717274 Uninitialized scalar field
** 717275 Uninitialized scalar field
Signed-off-by: Amit Kumar amitkuma@redhat.com