svn commit: r321662 - stable/11/sys/net

Dimitry Andric dim at FreeBSD.org
Fri Jul 28 18:47:05 UTC 2017


Author: dim
Date: Fri Jul 28 18:47:04 2017
New Revision: 321662
URL: https://svnweb.freebsd.org/changeset/base/321662

Log:
  MFC r321306:
  
  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
  Differential Revision:	https://reviews.freebsd.org/D11679

Modified:
  stable/11/sys/net/iflib.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/net/iflib.c
==============================================================================
--- stable/11/sys/net/iflib.c	Fri Jul 28 18:46:02 2017	(r321661)
+++ stable/11/sys/net/iflib.c	Fri Jul 28 18:47:04 2017	(r321662)
@@ -1262,8 +1262,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;
 	}
 #ifdef IFLIB_DIAGNOSTICS


More information about the svn-src-stable-11 mailing list