Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Jul 2020 14:21:56 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r363251 - head/sys/dev/safexcel
Message-ID:  <202007161421.06GELuqa057235@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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",



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