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: initialize variable tid in MMDSFindIno #16793

Merged
merged 1 commit into from Aug 8, 2017

Conversation

amitkumar50
Copy link

Fixes the coverity Issue:

** 717286 Uninitialized scalar field
CID 717286 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
2. uninit_member: Non-static class member tid is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Amit Kumar amitkuma@redhat.com

@@ -22,7 +22,7 @@ struct MMDSFindIno : public Message {
ceph_tid_t tid;
inodeno_t ino;

Copy link
Member

Choose a reason for hiding this comment

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

I would initialize them here (guaranteed), which can be overridden by the initializer list if needed.

@amitkumar50
Copy link
Author

Jenkins restest this please

@amitkumar50
Copy link
Author

@joscollin Thanks for comments. Done Changes.

ceph_tid_t tid;
inodeno_t ino;
ceph_tid_t tid = 0;
inodeno_t ino = {0};

Copy link
Member

Choose a reason for hiding this comment

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

nit: There is no need of = if you do it this way {0}. Change both lines to same method of initialization.

@amitkumar50
Copy link
Author

@joscollin Thanks for Comments. Done changes.

ceph_tid_t tid;
inodeno_t ino;
ceph_tid_t tid {0};
inodeno_t ino {0};

Copy link
Member

Choose a reason for hiding this comment

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

There is no need of initializing ino. See the definition of inodeno_t. By default it is initialized to 0 in the constructor.

@amitkumar50
Copy link
Author

@joscollin Done changes. Thanks for comments.

Fixes the coverity Issue:

** 717286 Uninitialized scalar field
CID 717286 (ceph#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
2. uninit_member: Non-static class member tid is not initialized
 in this constructor nor in any functions that it calls.

Signed-off-by: Amit Kumar amitkuma@redhat.com
@joscollin joscollin changed the title messages: Member initialization for class MMDSFindIno messages: initialize variable tid in MMDSFindIno Aug 8, 2017
@joscollin joscollin merged commit dd7d656 into ceph:master Aug 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants