svn commit: r321306 - head/sys/net

Dimitry Andric dim at FreeBSD.org
Thu Jul 20 20:28:32 UTC 2017


Author: dim
Date: Thu Jul 20 20:28:31 2017
New Revision: 321306
URL: https://svnweb.freebsd.org/changeset/base/321306

Log:
  Fix printf format warning in iflib.c
  
  Clang 5.0.0 got better warnings about printf format strings using %zd,
  and this leads to the following -Werror warning on e.g. arm:
  
      sys/net/iflib.c:1517:8: error: format specifies type 'ssize_t' (aka 'int') but the argument has type 'bus_size_t' (aka 'unsigned long') [-Werror,-Wformat]
                                                sctx->isc_tx_maxsize, nsegments, sctx->isc_tx_maxsegsize);
                                                ^~~~~~~~~~~~~~~~~~~~
      sys/net/iflib.c:1517:41: error: format specifies type 'ssize_t' (aka 'int') but the argument has type 'bus_size_t' (aka 'unsigned long') [-Werror,-Wformat]
                                                sctx->isc_tx_maxsize, nsegments, sctx->isc_tx_maxsegsize);
                                                                                 ^~~~~~~~~~~~~~~~~~~~~~~
  
  Fix this by casting bus_size_t arguments to uintmax_t, and using %ju
  instead.
  
  Reviewed by:	emaste
  MFC after:	3 days
  Differential Revision:	https://reviews.freebsd.org/D11679

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==============================================================================
--- head/sys/net/iflib.c	Thu Jul 20 20:27:19 2017	(r321305)
+++ head/sys/net/iflib.c	Thu Jul 20 20:28:31 2017	(r321306)
@@ -1513,8 +1513,8 @@ iflib_txsd_alloc(iflib_txq_t txq)
 			       NULL,			/* lockfuncarg */
 			       &txq->ift_desc_tag))) {
 		device_printf(dev,"Unable to allocate TX DMA tag: %d\n", err);
-		device_printf(dev,"maxsize: %zd nsegments: %d maxsegsize: %zd\n",
-					  sctx->isc_tx_maxsize, nsegments, sctx->isc_tx_maxsegsize);
+		device_printf(dev,"maxsize: %ju nsegments: %d maxsegsize: %ju\n",
+		    (uintmax_t)sctx->isc_tx_maxsize, nsegments, (uintmax_t)sctx->isc_tx_maxsegsize);
 		goto fail;
 	}
 	if ((err = bus_dma_tag_create(bus_get_dma_tag(dev),


More information about the svn-src-all mailing list