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

Stefan Sperling gerrit-no-reply at lists.osmocom.org
Thu Nov 22 06:57:57 UTC 2018


Stefan Sperling has submitted this change and it was merged. ( 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(-)

Approvals:
  Jenkins Builder: Verified
  Neels Hofmeyr: Looks good to me, but someone else must approve
  Pau Espin Pedrol: Looks good to me, approved



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: merged
Gerrit-Change-Id: I88da2164d975d7a232619b8d31c5eadeef0f3a80
Gerrit-Change-Number: 11856
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling <ssperling at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Stefan Sperling <ssperling at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181122/43cd7a54/attachment.html>


More information about the gerrit-log mailing list