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

common: initialize array in struct BackTrace #15864

Merged

Conversation

Projects
None yet
3 participants
@joscollin
Copy link
Member

joscollin commented Jun 23, 2017

Fixes the coverity scan report:

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

Quoting:

C++11 § 8.5,p7
if T is an array type, then each element is value-initialized;

Signed-off-by: Jos Collin jcollin@redhat.com

common: initialize array in struct BackTrace
Fixes the coverity scan report:
1412839 Uninitialized pointer field
CID 1412839 (#1 of 1): Uninitialized pointer field (UNINIT_CTOR)2. uninit_member: Non-static
class member array is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Jos Collin <jcollin@redhat.com>
@@ -18,7 +18,7 @@ struct BackTrace {
size_t size;
char **strings;

explicit BackTrace(int s) : skip(s) {
explicit BackTrace(int s) : skip(s), array{} {

This comment has been minimized.

Copy link
@tchaikov

tchaikov Jun 23, 2017

Contributor

use the default member initializer if you please.

This comment has been minimized.

Copy link
@joscollin

joscollin Jun 23, 2017

Author Member

@tchaikov Done. I think this applies now: http://en.cppreference.com/w/cpp/language/zero_initialization

If T is array type, each element is zero-initialized

I will squash it once we finalize the change.

common: initialize array in struct BackTrace
Fixed the review comments.

Signed-off-by: Jos Collin <jcollin@redhat.com>
@joscollin

This comment has been minimized.

Copy link
Member Author

joscollin commented Jun 24, 2017

Jenkins Retest this please

1 similar comment
@joscollin

This comment has been minimized.

Copy link
Member Author

joscollin commented Jun 24, 2017

Jenkins Retest this please

@joscollin

This comment has been minimized.

Copy link
Member Author

joscollin commented Jun 26, 2017

@tchaikov ping

@liewegas liewegas merged commit 63c29d4 into ceph:master Jun 27, 2017

4 of 5 checks passed

arm64 make check arm64 make check failed
Details
Signed-off-by all commits in this PR are signed
Details
Unmodified Submodules submodules for project are unmodified
Details
default Build finished.
Details
make check make check succeeded
Details

@joscollin joscollin deleted the joscollin:wip-CID1412839-uninitialized-pointer-field branch Jun 27, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.