Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Dec 2020 00:13:32 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r368686 - head/sys/dev/mrsas
Message-ID:  <202012160013.0BG0DWXn040704@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Wed Dec 16 00:13:32 2020
New Revision: 368686
URL: https://svnweb.freebsd.org/changeset/base/368686

Log:
  Use uintptr_t instead of unsigned long for pointers.
  
  The sense_ptr thing is quite broken.  As near as I can tell, the
  driver tries to copyout to a physical address rather than whatever
  user address the sense buffer should be copied to.  It is not
  immediately obvious what user address the sense buffer should be
  copied to.
  
  Reviewed by:	imp
  Obtained from:	CheriBSD
  Sponsored by:	DARPA
  Differential Revision:	https://reviews.freebsd.org/D27578

Modified:
  head/sys/dev/mrsas/mrsas_ioctl.c

Modified: head/sys/dev/mrsas/mrsas_ioctl.c
==============================================================================
--- head/sys/dev/mrsas/mrsas_ioctl.c	Wed Dec 16 00:11:30 2020	(r368685)
+++ head/sys/dev/mrsas/mrsas_ioctl.c	Wed Dec 16 00:13:32 2020	(r368686)
@@ -136,7 +136,7 @@ mrsas_passthru(struct mrsas_softc *sc, void *arg, u_lo
 	 * iocpacket itself.
 	 */
 	kern_sge32 = (struct mrsas_sge32 *)
-	    ((unsigned long)cmd->frame + user_ioc->sgl_off);
+	    ((uintptr_t)cmd->frame + user_ioc->sgl_off);
 
 	memset(ioctl_data_tag, 0, (sizeof(bus_dma_tag_t) * MAX_IOCTL_SGE));
 	memset(ioctl_data_dmamap, 0, (sizeof(bus_dmamap_t) * MAX_IOCTL_SGE));
@@ -243,7 +243,7 @@ mrsas_passthru(struct mrsas_softc *sc, void *arg, u_lo
 			goto out;
 		}
 		sense_ptr =
-		    (unsigned long *)((unsigned long)cmd->frame + user_ioc->sense_off);
+		    (unsigned long *)((uintptr_t)cmd->frame + user_ioc->sense_off);
 		*sense_ptr = ioctl_sense_phys_addr;
 	}
 	/*
@@ -290,9 +290,9 @@ mrsas_passthru(struct mrsas_softc *sc, void *arg, u_lo
 		 * sense_buff points to the location that has the user sense
 		 * buffer address
 		 */
-		sense_ptr = (unsigned long *)((unsigned long)user_ioc->frame.raw +
+		sense_ptr = (unsigned long *)((uintptr_t)user_ioc->frame.raw +
 		    user_ioc->sense_off);
-		ret = copyout(ioctl_sense_mem, (unsigned long *)*sense_ptr,
+		ret = copyout(ioctl_sense_mem, (unsigned long *)(uintptr_t)*sense_ptr,
 		    user_ioc->sense_len);
 		if (ret) {
 			device_printf(sc->mrsas_dev, "IOCTL sense copyout failed!\n");



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