Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Mar 2018 17:46:26 +0000 (UTC)
From:      Brooks Davis <brooks@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r331634 - in stable/11/sys: dev/isp modules/isp
Message-ID:  <201803271746.w2RHkQsY070429@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brooks
Date: Tue Mar 27 17:46:25 2018
New Revision: 331634
URL: https://svnweb.freebsd.org/changeset/base/331634

Log:
  MFC r330876, r330945
  
  r330876:
  Fix ISP_FC_LIP and ISP_RESCAN on big-endian 64-bit systems.
  
  For _IO() ioctls, addr is a pointer to uap->data which is a caddr_t.
  When the caddr_t stores an int, dereferencing addr as an (int *) results
  in truncation on little-endian 64-bit systems and corruption (owing to
  extracting top bits) on big-endian 64-bit systems. In practice the
  value of chan was probably always zero on systems of the latter type as
  all such FreeBSD platforms use a register-based calling convention.
  
  Reviewed by:	mav
  Obtained from:	CheriBSD
  Sponsored by:	DARPA, AFRL
  Differential Revision:	https://reviews.freebsd.org/D14673
  
  r330945:
  Add opt_compat.h to isp(4) as required by r330876.

Modified:
  stable/11/sys/dev/isp/isp_freebsd.c
  stable/11/sys/modules/isp/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/isp/isp_freebsd.c
==============================================================================
--- stable/11/sys/dev/isp/isp_freebsd.c	Tue Mar 27 17:43:03 2018	(r331633)
+++ stable/11/sys/dev/isp/isp_freebsd.c	Tue Mar 27 17:46:25 2018	(r331634)
@@ -444,7 +444,7 @@ ispioctl(struct cdev *dev, u_long c, caddr_t addr, int
 
 	case ISP_RESCAN:
 		if (IS_FC(isp)) {
-			chan = *(int *)addr;
+			chan = *(intptr_t *)addr;
 			if (chan < 0 || chan >= isp->isp_nchan) {
 				retval = -ENXIO;
 				break;
@@ -461,7 +461,7 @@ ispioctl(struct cdev *dev, u_long c, caddr_t addr, int
 
 	case ISP_FC_LIP:
 		if (IS_FC(isp)) {
-			chan = *(int *)addr;
+			chan = *(intptr_t *)addr;
 			if (chan < 0 || chan >= isp->isp_nchan) {
 				retval = -ENXIO;
 				break;

Modified: stable/11/sys/modules/isp/Makefile
==============================================================================
--- stable/11/sys/modules/isp/Makefile	Tue Mar 27 17:43:03 2018	(r331633)
+++ stable/11/sys/modules/isp/Makefile	Tue Mar 27 17:46:25 2018	(r331634)
@@ -4,7 +4,7 @@
 
 KMOD=	isp
 SRCS=	bus_if.h device_if.h pci_if.h \
-	opt_cam.h opt_ddb.h opt_isp.h \
+	opt_cam.h opt_compat.h opt_ddb.h opt_isp.h \
 	isp.c isp_library.c isp_target.c isp_freebsd.c isp_pci.c
 
 .if ${MACHINE} == sparc64



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