-
Notifications
You must be signed in to change notification settings - Fork 1.5k
net/pkt: Fix coverity issue #17520
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
base: master
Are you sure you want to change the base?
net/pkt: Fix coverity issue #17520
Conversation
The value ret is overwritten after being assigned a value. Signed-off-by: zhangshuai39 <[email protected]>
| { | ||
| nerr("ERROR: Unsupported socket type: %d\n", psock->s_type); | ||
| ret = -ENOSYS; | ||
| return -ENOSYS; |
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.
This is not just a Coverity issue. Your update has altered the behavior of this Func. You need to provide a more detailed analysis to explain the impact.
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 change does seem reasonable: if the socket type is unsupported then it seems reasonable that we should not proceed with the rest of the function.
However, I agree that the PR description and commit log need to be updated. Rather than "Fix coverity issue" I recommend something like: "net/pkt_recvmsg(): Fix error handling in case of unsupported socket types". You can include "Found by Coverity" in the PR description and log message.
Also I recommend to update the function's docstring to indicate that psock must be of type SOCK_RAW. Currently that's not documented.
Have you tested the network code in some way to exercise this code path?
acassis
left a comment
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.
@zs39 Just fix the PR description and the commit log message to be more accurate
linguini1
left a comment
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.
Please include an explanation of what test you performed and the results in your testing section. "self-test" isn't a sufficient description.
Summary
The value ret is overwritten after being assigned a value.
Impact
Scenario of receiving a PKT socket of type non-SOCK_RAW
Testing
It has passed self-testing in sim & qemu-goldfish-armeabi-v7a-ap