-
Notifications
You must be signed in to change notification settings - Fork 2k
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
net/nanocoap: fix issues reported by scan-build #12584
Conversation
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 changes make sense and don't change functionality in the non-error case.
Errors that were previously silently dropped are now properly reported.
sys/include/net/nanocoap.h
Outdated
@@ -585,7 +585,7 @@ ssize_t coap_opt_get_next(const coap_pkt_t *pkt, coap_optpos_t *opt, | |||
* @param[out] value start of the option value | |||
* | |||
* @return length of option; 0 if the option exists but is empty | |||
* @return -ENOENT if option not found | |||
* @return -ENOENT if option not found or option cannot be parsed |
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.
Shouldn't this rather be a distinct error code? E.g. -EINVAL
?
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.
Good idea. Changed.
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.
Re-ACK
Please squash. |
This fixes a potential use of uninitialized len in subsequent function calls. This was reported by scan-build
76879c7
to
8b06560
Compare
squashed (better late than never ;) ) |
ACK upholds |
Contribution description
This PR is fixing all issues reported by scan-build in nanocoap.c.
Testing procedure
Run
TOOLCHAIN=llvm make -C examples/nanocoap_server/ scan-build
On master, several warning are raised in nanocoap.c. With this PR, all are fixed.
Test the
examples/nanocoap_server
and verify it still worksIssues/PRs references
Tick one item in #11852