summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorbrooks <brooks@FreeBSD.org>2018-03-27 17:46:25 +0000
committerbrooks <brooks@FreeBSD.org>2018-03-27 17:46:25 +0000
commit46a38e8a577073c04d90ed396b0604db66b8b0cd (patch)
tree7a272cf351f7e49de13939f39c6fb07d659dba99 /sys
parent9e25b279a2b64ef3bb297353b3874987277be25b (diff)
downloadFreeBSD-src-46a38e8a577073c04d90ed396b0604db66b8b0cd.zip
FreeBSD-src-46a38e8a577073c04d90ed396b0604db66b8b0cd.tar.gz
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.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/isp/isp_freebsd.c4
-rw-r--r--sys/modules/isp/Makefile2
2 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/isp/isp_freebsd.c b/sys/dev/isp/isp_freebsd.c
index 464c805..3f78508 100644
--- a/sys/dev/isp/isp_freebsd.c
+++ b/sys/dev/isp/isp_freebsd.c
@@ -444,7 +444,7 @@ ispioctl(struct cdev *dev, u_long c, caddr_t addr, int flags, struct thread *td)
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 flags, struct thread *td)
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;
diff --git a/sys/modules/isp/Makefile b/sys/modules/isp/Makefile
index d59d540..bb13bdf 100644
--- a/sys/modules/isp/Makefile
+++ b/sys/modules/isp/Makefile
@@ -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
OpenPOWER on IntegriCloud