Skip to content
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

Merged
merged 1 commit into from Aug 11, 2017

Conversation

amitkumar50
Copy link

Fixes the coverity issues:

** 717271 Uninitialized scalar field

  1. uninit_member: Non-static class member from_mds is not initialized
    in this constructor nor in any functions that it calls.
  2. uninit_member: Non-static class member dir_rep is not initialized
    in this constructor nor in any functions that it calls.
    CID 717271 (FreeBSD support. #1 of 1): Uninitialized scalar field (UNINIT_CTOR)
  3. uninit_member: Non-static class member discover is not initialized
    in this constructor nor in any functions that it calls.

** 717272 Uninitialized scalar field

  1. uninit_member: Non-static class member want_base_dir is not initialized
    in this constructor nor in any functions that it calls.
    CID 717272 (FreeBSD support. #1 of 1): Uninitialized scalar field (UNINIT_CTOR)
  2. 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

  1. uninit_member: Non-static class member wanted_base_dir is not initialized
    in this constructor nor in any functions that it calls.
  2. uninit_member: Non-static class member wanted_xlocked is not initialized
    in this constructor nor in any functions that it calls.
  3. uninit_member: Non-static class member flag_error_dn is not initialized
    in this constructor nor in any functions that it calls.
  4. uninit_member: Non-static class member flag_error_dir is not initialized
    in this constructor nor in any functions that it calls.
  5. uninit_member: Non-static class member unsolicited is not initialized
    in this constructor nor in any functions that it calls.
  6. uninit_member: Non-static class member dir_auth_hint is not initialized
    in this constructor nor in any functions that it calls.
    CID 717274 (FreeBSD support. #1 of 1): Uninitialized scalar field (UNINIT_CTOR)
  7. 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 (#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

@liewegas liewegas added cephfs Ceph File System cleanup labels Aug 8, 2017
@amitkumar50
Copy link
Author

jenkins retest this please

@@ -19,7 +19,7 @@
#include "include/types.h"

class MExportDirDiscover : public Message {
mds_rank_t from;
mds_rank_t from = 0;
Copy link
Member

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.

Copy link
Author

Choose a reason for hiding this comment

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

Done..

@@ -19,10 +19,10 @@
#include "msg/Message.h"

class MDirUpdate : public Message {
mds_rank_t from_mds;
mds_rank_t from_mds = 0;
Copy link
Member

Choose a reason for hiding this comment

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

0 has MDS meaning

Copy link
Author

Choose a reason for hiding this comment

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

Done..

int32_t dir_rep;
int32_t discover;
int32_t dir_rep = 0;
int32_t discover = 0;
Copy link
Member

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?

Copy link
Author

Choose a reason for hiding this comment

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

Done..

@@ -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;
Copy link
Member

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.

@amitkumar50 amitkumar50 force-pushed the cov-messages-6 branch 2 times, most recently from aea509c to 406348f Compare August 11, 2017 07:04
@amitkumar50
Copy link
Author

@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
@gregsfortytwo gregsfortytwo merged commit 4e69d80 into ceph:master Aug 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cephfs Ceph File System cleanup
Projects
None yet
3 participants