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

msg, messages: coverity fixes #13473

Merged
merged 4 commits into from Feb 18, 2017
Merged

Conversation

tchaikov
Copy link
Contributor

No description provided.

addresses CID 1400661:  Uninitialized variables  (UNINIT)

Signed-off-by: Kefu Chai <kchai@redhat.com>
addresses CID 1400658:  Incorrect expression  (NO_EFFECT)

Signed-off-by: Kefu Chai <kchai@redhat.com>
addresses CID 1400656:  Incorrect expression  (NO_EFFECT)

Signed-off-by: Kefu Chai <kchai@redhat.com>
@@ -427,9 +427,6 @@ int Pipe::accept()
goto fail_unlocked;
}

// sanitize features
connect.features = connect.features;

Copy link
Member

Choose a reason for hiding this comment

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

Did you check the history on these? I don't recognize them but the warning made me concerned they are meant to do something (say, sanitize the feature list into something we understand?) via C++ magic that has failed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gregsfortytwo i did check the history as this statement is quite weird from the first glance. they were meant to do something. the commit Sage changed to this is ff19592. and ceph_sanitize_features() has gone. i see no reason to keep the foo = foo around anymore.

Copy link
Member

Choose a reason for hiding this comment

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

Yep, I was just sloppy removing the sanitize call!

int64_t m_quant_size;
int32_t m_buckets;
const char *m_name = nullptr;
scale_type_d m_scale_type = 0;
Copy link

Choose a reason for hiding this comment

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

This does not compile. Please initialize with SCALE_LINEAR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed and repushed.

Copy link

Choose a reason for hiding this comment

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

@tchaikov huh, the fix won't be that easy, adding default values removed default constructors.

Not that pretty but works:

  struct axis_config_d {
    explicit axis_config_d(const char *name = nullptr,
                           scale_type_d scale_type = SCALE_LINEAR,
                           int64_t min = 0, int64_t quant_size = 0,
                           int32_t buckets = 0)
        : m_name(name),
          m_scale_type(scale_type),
          m_min(min),
          m_quant_size(quant_size),
          m_buckets(buckets) {}

    const char *m_name;
    scale_type_d m_scale_type;
    int64_t m_min;
    int64_t m_quant_size;
    int32_t m_buckets;
  };

@tchaikov tchaikov force-pushed the wip-coverity-fixes branch 2 times, most recently from 68df34f to e3c2f37 Compare February 17, 2017 14:07
addresses CID 1400670:    (UNINIT_CTOR)

Signed-off-by: Kefu Chai <kchai@redhat.com>
@tchaikov tchaikov changed the title msg, rbd-nbd, messages: coverity fixes msg, messages: coverity fixes Feb 18, 2017
@tchaikov
Copy link
Contributor Author

tchaikov commented Feb 18, 2017

@dillaman i dropped the rbd-nbd changes from this PR, we can come back later with better idea later.

@tchaikov
Copy link
Contributor Author

@tchaikov tchaikov merged commit 780f4c0 into ceph:master Feb 18, 2017
@tchaikov tchaikov deleted the wip-coverity-fixes branch February 18, 2017 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants