Skip to content

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 root@stephanos.io

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 <root@stephanos.io>
@stephanosio stephanosio requested review from galak, gmarull and nashif 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