-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
test: address coverity issue #44800
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
test: address coverity issue #44800
Conversation
Coverity is reporting issues with negative returns. I think that is because size_t page = GetPageSize(); will always result in page being positive even if GetPageSize fails and returns -1 since size_t cannot be negative. This then would result n the check right afterwards not catching the failure. Fix by converting to size_t after we do the check. Signed-off-by: Michael Dawson <mdawson@devrus.com>
Reports from coverity
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might be missing something but I don't see how this helps. GoogleTest's EXPECT_GE
does not stop execution, it just logs an error. (I didn't know this at first, which is why I used EXPECT_GE
in GetPageSize()
, see #44795.)
That's kind of exactly what |
@tniessen I can't remember what I was thinking at this point, but I see your point so closing. |
Coverity is reporting issues with negative
returns. I think that is because
size_t page = GetPageSize();
will always result in page being positive even if GetPageSize fails and returns -1 since size_t cannot be negative. This then would result n the check right afterwards not catching the failure.
Fix by converting to size_t after we do the check.
Signed-off-by: Michael Dawson mdawson@devrus.com