svn commit: r363251 - head/sys/dev/safexcel

Mark Johnston markj at FreeBSD.org
Thu Jul 16 14:21:56 UTC 2020


Author: markj
Date: Thu Jul 16 14:21:55 2020
New Revision: 363251
URL: https://svnweb.freebsd.org/changeset/base/363251

Log:
  safexcel(4): Silence an integer truncation warning.
  
  In practice overflow is not possible, but we might as well use the right
  type for DMA ring sizes.
  
  CID:		1430468
  MFC after:	1 week

Modified:
  head/sys/dev/safexcel/safexcel.c

Modified: head/sys/dev/safexcel/safexcel.c
==============================================================================
--- head/sys/dev/safexcel/safexcel.c	Thu Jul 16 14:12:54 2020	(r363250)
+++ head/sys/dev/safexcel/safexcel.c	Thu Jul 16 14:21:55 2020	(r363251)
@@ -901,7 +901,8 @@ static int
 safexcel_dma_init(struct safexcel_softc *sc)
 {
 	struct safexcel_ring *ring;
-	int error, i, size;
+	bus_size_t size;
+	int error, i;
 
 	for (i = 0; i < sc->sc_config.rings; i++) {
 		ring = &sc->sc_ring[i];
@@ -937,8 +938,9 @@ safexcel_dma_init(struct safexcel_softc *sc)
 		    (struct safexcel_cmd_descr *)ring->cdr.dma.vaddr;
 
 		/* Allocate additional CDR token memory. */
-		error = safexcel_dma_alloc_mem(sc, &ring->dma_atok,
-		    sc->sc_config.atok_offset * SAFEXCEL_RING_SIZE);
+		size = (bus_size_t)sc->sc_config.atok_offset *
+		    SAFEXCEL_RING_SIZE;
+		error = safexcel_dma_alloc_mem(sc, &ring->dma_atok, size);
 		if (error != 0) {
 			device_printf(sc->sc_dev,
 			    "failed to allocate atoken DMA memory, error %d\n",


More information about the svn-src-all mailing list