Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Jan 2020 01:42:48 +0000 (UTC)
From:      Don Lewis <truckman@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r357132 - stable/12/sbin/swapon
Message-ID:  <202001260142.00Q1gmcG040863@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: truckman
Date: Sun Jan 26 01:42:47 2020
New Revision: 357132
URL: https://svnweb.freebsd.org/changeset/base/357132

Log:
  MFC r355553
  
  Fix a logic bug in error handling code.  It is an error if p == NULL.
  The linelen tests are only meaningful when p != NULL.
  
  Reported by:	Coverity
  Coverity CID:	1368655

Modified:
  stable/12/sbin/swapon/swapon.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/swapon/swapon.c
==============================================================================
--- stable/12/sbin/swapon/swapon.c	Sun Jan 26 00:41:38 2020	(r357131)
+++ stable/12/sbin/swapon/swapon.c	Sun Jan 26 01:42:47 2020	(r357132)
@@ -542,7 +542,7 @@ swap_on_off_md(const char *name, char *mntops, int doi
 				goto err;
 			}
 			p = fgetln(sfd, &linelen);
-			if (p == NULL &&
+			if (p == NULL ||
 			    (linelen < 2 || linelen > sizeof(linebuf))) {
 				warn("mdconfig (attach) unexpected output");
 				ret = NULL;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202001260142.00Q1gmcG040863>