-
Notifications
You must be signed in to change notification settings - Fork 3k
Suppress Coverity warnings #11472
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
Suppress Coverity warnings #11472
Conversation
888f2a8
to
5288e87
Compare
@hugueskamba, thank you for your changes. |
5288e87
to
3a44ce6
Compare
platform/source/mbed_retarget.cpp
Outdated
@@ -448,6 +448,7 @@ std::FILE *fdopen(FileHandle *fh, const char *mode) | |||
} | |||
// Then bind that to the C stream. If successful, C library | |||
// takes ownership and responsibility to close. | |||
// coverity[negative_returns] |
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 don't understand the coverity warning.
Is it because std is missing?
std::FILE *stream = std::fdopen(fd, mode);
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.
Not sure but my wild guess is that it is related to IAR implementation of it...
GIven the end of the message (Note: The source code implementation of the function has been overridden by a builtin model.
), it seems my guess could be right.
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.
The diagnostic is correct - it's spotted that we could be passing a negative fd
to ::fdopen
.
(The "built-in model" bit is that it knows what ::fdopen
is supposed to do, and it knows it shouldn't be getting a negative fd
.)
Problem should be fixed by changing line 446 from if (!fd)
to if (fd < 0)
. bind_to_fd
returns negative on failure, not 0. 0 is actually a valid file descriptor, although it's reserved for console input.
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.
3a44ce6
to
93f50ee
Compare
This force-push corrects the code where |
Test run: FAILEDSummary: 1 of 11 test jobs failed Failed test jobs:
|
test restarted, internal issue |
Description
Ignore the following Coverity warnings:
Pull request type
Reviewers
Release Notes