All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] net: caif: use correct format specifier
@ 2016-07-31  7:19 Heinrich Schuchardt
  2016-08-01 20:43 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Heinrich Schuchardt @ 2016-07-31  7:19 UTC (permalink / raw)
  To: Dmitry Tarnyagin; +Cc: netdev, linux-kernel, Heinrich Schuchardt

%u is the wrong format specifier for int.
size_t cannot be converted to int without possible
loss of information.

So leave the result as size_t and use %zu as format specifier.

cf. Documentation/printk-formats.txt

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 drivers/net/caif/caif_spi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/caif/caif_spi.c b/drivers/net/caif/caif_spi.c
index 4721948..3a529fb 100644
--- a/drivers/net/caif/caif_spi.c
+++ b/drivers/net/caif/caif_spi.c
@@ -185,8 +185,8 @@ static ssize_t print_frame(char *buf, size_t size, char *frm,
 			/* Fast forward. */
 			i = count - cut;
 			len += snprintf((buf + len), (size - len),
-					"--- %u bytes skipped ---\n",
-					(int)(count - (cut * 2)));
+					"--- %zu bytes skipped ---\n",
+					count - (cut * 2));
 		}
 
 		if ((!(i % 10)) && i) {
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] net: caif: use correct format specifier
  2016-07-31  7:19 [PATCH 1/1] net: caif: use correct format specifier Heinrich Schuchardt
@ 2016-08-01 20:43 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-08-01 20:43 UTC (permalink / raw)
  To: xypron.glpk; +Cc: dmitry.tarnyagin, netdev, linux-kernel

From: Heinrich Schuchardt <xypron.glpk@gmx.de>
Date: Sun, 31 Jul 2016 09:19:50 +0200

> %u is the wrong format specifier for int.
> size_t cannot be converted to int without possible
> loss of information.
> 
> So leave the result as size_t and use %zu as format specifier.
> 
> cf. Documentation/printk-formats.txt
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-01 20:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-31  7:19 [PATCH 1/1] net: caif: use correct format specifier Heinrich Schuchardt
2016-08-01 20:43 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.