pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/41940?usp=email )


Change subject: osmo_io: Add assert to validate inconditional
......................................................................

osmo_io: Add assert to validate inconditional

The do-while loop is entered:
* First time: "tail_msg != NULL" (since it was set to "msg").
* Subsequent times: coming from "while" condition:
** tail_msg != NULL
** res == IOFD_SEG_ACT_HANDLE_MORE, which means iofd->pending != NULL.

Hence, always either "iofd->pending" or "tail_msg" is valid when entering
the loop, and hence "msg" will also be valid.

Related: Coverity CID#557196
Change-Id: If29363edfba576370e306fb5b160d9f038018130
---
M src/core/osmo_io.c
1 file changed, 1 insertion(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/40/41940/1

diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c
index 38814ae..514d592 100644
--- a/src/core/osmo_io.c
+++ b/src/core/osmo_io.c
@@ -437,6 +437,7 @@
                        msg = iofd->pending;
                        iofd->pending = NULL;
                } else {
+                       OSMO_ASSERT(tail_msg);
                        msg = tail_msg;
                        tail_msg = NULL;
                }

--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41940?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If29363edfba576370e306fb5b160d9f038018130
Gerrit-Change-Number: 41940
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>

Reply via email to