Change in osmo-ggsn[master]: check ioctl() call return value in tun_new()

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/.

Stefan Sperling gerrit-no-reply at lists.osmocom.org
Wed Nov 21 13:14:27 UTC 2018


Stefan Sperling has uploaded this change for review. ( https://gerrit.osmocom.org/11856


Change subject: check ioctl() call return value in tun_new()
......................................................................

check ioctl() call return value in tun_new()

Coverity complains about a missing ioctl() return value check.
Check for failure of the TUNSETNOCSUM ioctl and log a warning
if it fails.

Change-Id: I88da2164d975d7a232619b8d31c5eadeef0f3a80
Related: CID#57661
---
M lib/tun.c
1 file changed, 4 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/56/11856/1

diff --git a/lib/tun.c b/lib/tun.c
index fa4c37d..6ae006b 100644
--- a/lib/tun.c
+++ b/lib/tun.c
@@ -193,7 +193,10 @@
 		strncpy((*tun)->devname, ifr.ifr_name, IFNAMSIZ);
 		(*tun)->devname[IFNAMSIZ - 1] = 0;
 
-		ioctl((*tun)->fd, TUNSETNOCSUM, 1);	/* Disable checksums */
+		/* Disable checksums */
+		if (ioctl((*tun)->fd, TUNSETNOCSUM, 1) < 0) {
+			SYS_ERR(DTUN, LOGL_NOTICE, errno, "could not disable checksum on %s", (*tun)->devname);
+		}
 		return 0;
 	} else {
 		strncpy((*tun)->devname, dev_name, IFNAMSIZ);

-- 
To view, visit https://gerrit.osmocom.org/11856
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I88da2164d975d7a232619b8d31c5eadeef0f3a80
Gerrit-Change-Number: 11856
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling <ssperling at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181121/d0a49710/attachment.htm>


More information about the gerrit-log mailing list