Skip to content

Conversation

@zs39
Copy link
Contributor

@zs39 zs39 commented Dec 16, 2025

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

The value ret is overwritten after being assigned a value.

Signed-off-by: zhangshuai39 <[email protected]>
@github-actions github-actions bot added Area: Networking Effects networking subsystem Size: XS The size of the change in this PR is very small labels Dec 16, 2025
{
nerr("ERROR: Unsupported socket type: %d\n", psock->s_type);
ret = -ENOSYS;
return -ENOSYS;
Copy link
Contributor

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.

Copy link
Contributor

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?

Copy link
Contributor

@acassis acassis left a 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

Copy link
Contributor

@linguini1 linguini1 left a 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.

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

Labels

Area: Networking Effects networking subsystem Size: XS The size of the change in this PR is very small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants