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

osd: Initialization of data members #17691

Merged
merged 1 commit into from Dec 13, 2017
Merged

Conversation

amitkumar50
Copy link

Fixes the coverity issues:

** 717336 Uninitialized scalar field

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

** 728001 Uninitialized scalar field

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

** 1405358 Uninitialized scalar field

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

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

@@ -4404,7 +4404,7 @@ struct C_ChecksumRead : public Context {
OSDOp &osd_op;
Checksummer::CSumType csum_type;
bufferlist init_value_bl;
ceph_le64 read_length;
ceph_le64 read_length {};
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Avoid unwanted space before {

@amitkumar50
Copy link
Author

Done Thanks @joscollin

@@ -4404,7 +4404,7 @@ struct C_ChecksumRead : public Context {
OSDOp &osd_op;
Checksummer::CSumType csum_type;
bufferlist init_value_bl;
ceph_le64 read_length;
ceph_le64 read_length{};
Copy link
Member

@joscollin joscollin Sep 18, 2017

Choose a reason for hiding this comment

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

ceph_le64 seems to be an unsigned integer. So better initialize with 0 to be specific.

@amitkumar50
Copy link
Author

Done Thanks @joscollin

joscollin
joscollin previously approved these changes Oct 20, 2017
@tchaikov
Copy link
Contributor

/home/jenkins-build/build/workspace/ceph-dev-new-build/ARCH/x86_64/AVAILABLE_ARCH/x86_64/AVAILABLE_DIST/centos7/DIST/centos7/MACHINE_SIZE/huge/release/13.0.0-2372-g6738ee1/rpm/el7/BUILD/ceph-13.0.0-2372-g6738ee1/src/osd/PrimaryLogPG.cc:4381:27: error: could not convert '0' from 'int' to 'ceph_le64 {aka ceph_le<long long unsigned int>}'
   ceph_le64 read_length = 0;
                           ^

Copy link
Contributor

@tchaikov tchaikov left a comment

Choose a reason for hiding this comment

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

does not compile

@joscollin joscollin dismissed their stale review October 25, 2017 04:00

Right. I have tested it myself now.

@amitkumar50
Copy link
Author

@tchaikov Done Changes. Thanks

Fixes the coverity issues:

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

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

Signed-off-by: Amit Kumar <amitkuma@redhat.com>
@amitkumar50
Copy link
Author

@tchaikov can you plz review

@yuriw
Copy link
Contributor

yuriw commented Dec 12, 2017

@yuriw yuriw merged commit 230e1e4 into ceph:master Dec 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants