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

ceph-dencoder: Silence coverity CID 1412579 #15744

Merged
merged 1 commit into from Jun 20, 2017

Conversation

Projects
None yet
2 participants
@badone
Contributor

badone commented Jun 17, 2017

141 if (i == 0)
142 i = m_list.size();
143 if ((i == 0) || (i > m_list.size()))
144 return "invalid id for generated object";
145 typename list<T*>::iterator p = m_list.begin();
146 for (i--; i > 0 && p != m_list.end(); ++p, --i) ;

CID 1412579:  API usage errors  (INVALIDATE_ITERATOR)
Dereferencing iterator "p" though it is already past the end

of its container.
147 m_object = *p;
148 return string();
149 }
150
151 bool is_deterministic() override {
152 return !nondeterministic;

Signed-off-by: Brad Hubbard bhubbard@redhat.com

@badone

This comment has been minimized.

Contributor

badone commented Jun 17, 2017

@liewegas @joscollin I think this might be a fix for the invalidated iterator warning. We all know it's a false positive but I would hope this will silence it and has the benefit of being more expressive IMHO. If this doesn't work I'll be happy to try the "assert(p != m_list.end())" fix.

ceph-dencoder: Silence coverity CID 1412579
141         if (i == 0)
142           i = m_list.size();
143         if ((i == 0) || (i > m_list.size()))
144           return "invalid id for generated object";
145         typename list<T*>::iterator p = m_list.begin();
146         for (i--; i > 0 && p != m_list.end(); ++p, --i) ;
>>>     CID 1412579:  API usage errors  (INVALIDATE_ITERATOR)
>>>     Dereferencing iterator "p" though it is already past the end
of its container.
147         m_object = *p;
148         return string();
149       }
150
151       bool is_deterministic() override {
152         return !nondeterministic;

Signed-off-by: Brad Hubbard <bhubbard@redhat.com>

@liewegas liewegas merged commit 1be29e3 into ceph:master Jun 20, 2017

4 checks passed

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

@badone badone removed the needs-review label Jun 20, 2017

@badone badone deleted the badone:wip-CID-1412579 branch Jun 20, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment