pespin has submitted this change. (
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(-)
Approvals:
Jenkins Builder: Verified
osmith: Looks good to me, approved
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: merged
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If29363edfba576370e306fb5b160d9f038018130
Gerrit-Change-Number: 41940
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: jolly <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>