[PATCH] libosmo-abis[master]: fix signed/unsigned bug in ipa_client_conn_open()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sat Nov 26 08:51:24 UTC 2016


Review at  https://gerrit.osmocom.org/1286

fix signed/unsigned bug in ipa_client_conn_open()

If osmo_sock_init() would ever return a negative FD together with
errno == EINPROGRESS, we would have attempted to register that negative
FD with the select() main loop handling, whihc of course doesn't work.

EINPROGRESS for a non-blocking connecting socket is handled inside
osmo_sock_init() and would result in it returning a positive FD, so the
above case is of theoretical significance only.

Change-Id: Id01eb0d48eea6cab1fbc720c52361101b8ea4e35
Fixes: Coverity CID 57856
---
M src/input/ipa.c
1 file changed, 2 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/86/1286/1

diff --git a/src/input/ipa.c b/src/input/ipa.c
index f90d62c..ce155ce 100644
--- a/src/input/ipa.c
+++ b/src/input/ipa.c
@@ -213,10 +213,8 @@
 	ret = osmo_sock_init(AF_INET, SOCK_STREAM, IPPROTO_TCP,
 			     link->addr, link->port,
 			     OSMO_SOCK_F_CONNECT|OSMO_SOCK_F_NONBLOCK);
-	if (ret < 0) {
-		if (errno != EINPROGRESS)
-			return ret;
-	}
+	if (ret < 0)
+		return ret;
 	link->ofd->fd = ret;
 	link->ofd->when |= BSC_FD_WRITE;
 	if (osmo_fd_register(link->ofd) < 0) {

-- 
To view, visit https://gerrit.osmocom.org/1286
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id01eb0d48eea6cab1fbc720c52361101b8ea4e35
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list