Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Oct 2014 12:40:16 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r272621 - stable/10/sys/cam/ctl
Message-ID:  <201410061240.s96CeGRw056422@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Mon Oct  6 12:40:15 2014
New Revision: 272621
URL: https://svnweb.freebsd.org/changeset/base/272621

Log:
  MFC r271354: Fix couple off-by-one range check errors, reported by Coverity.

Modified:
  stable/10/sys/cam/ctl/ctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl.c	Mon Oct  6 12:39:25 2014	(r272620)
+++ stable/10/sys/cam/ctl/ctl.c	Mon Oct  6 12:40:15 2014	(r272621)
@@ -2545,7 +2545,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, 
 
 		mtx_lock(&softc->ctl_lock);
 		if (((ooa_hdr->flags & CTL_OOA_FLAG_ALL_LUNS) == 0)
-		 && ((ooa_hdr->lun_num > CTL_MAX_LUNS)
+		 && ((ooa_hdr->lun_num >= CTL_MAX_LUNS)
 		  || (softc->ctl_luns[ooa_hdr->lun_num] == NULL))) {
 			mtx_unlock(&softc->ctl_lock);
 			free(entries, M_CTL);
@@ -2740,7 +2740,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, 
 #ifdef CTL_IO_DELAY
 		mtx_lock(&softc->ctl_lock);
 
-		if ((delay_info->lun_id > CTL_MAX_LUNS)
+		if ((delay_info->lun_id >= CTL_MAX_LUNS)
 		 || (softc->ctl_luns[delay_info->lun_id] == NULL)) {
 			delay_info->status = CTL_DELAY_STATUS_INVALID_LUN;
 		} else {



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