Skip to content
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: coap: Remove resource pointer NULL check #48483

Merged
merged 1 commit into from
Aug 1, 2022

Conversation

stephanosio
Copy link
Member

@stephanosio stephanosio commented Jul 29, 2022

This commit removes the resource pointer NULL check inside the resource
enumeration loop of the coap_well_known_core_get function because the
expression (resource + 1) will never evaluate to NULL (aka. 0).

This fixes the "comparison will always evaluate as ‘true’ for the
pointer operand" warning generated by the GCC 12.

Signed-off-by: Stephanos Ioannidis [email protected]

p.s. In general, this function does not seem very sane to me (e.g. doing NULL check on an incremented pointer, potentially dereferencing beyond the resource array bounds), but fixing this is beyond the scope of this PR.

This commit removes the resource pointer NULL check inside the resource
enumeration loop of the `coap_well_known_core_get` function because the
expression `(resource + 1)` will never evaluate to NULL (aka. 0).

This fixes the "comparison will always evaluate as ‘true’ for the
pointer operand" warning generated by the GCC 12.

Signed-off-by: Stephanos Ioannidis <[email protected]>
@stephanosio stephanosio requested review from nashif, galak and gmarull July 29, 2022 16:46
@carlescufi carlescufi merged commit 532d267 into zephyrproject-rtos:main Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants