Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1452780 > unrolled thread

[PATCH 1/1] net: caif: use correct format specifier

Started byHeinrich Schuchardt <xypron.glpk@gmx.de>
First post2016-07-31 09:30 +0200
Last post2016-08-01 23:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/1] net: caif: use correct format specifier Heinrich Schuchardt <xypron.glpk@gmx.de> - 2016-07-31 09:30 +0200
    Re: [PATCH 1/1] net: caif: use correct format specifier David Miller <davem@davemloft.net> - 2016-08-01 23:00 +0200

#1452780 — [PATCH 1/1] net: caif: use correct format specifier

FromHeinrich Schuchardt <xypron.glpk@gmx.de>
Date2016-07-31 09:30 +0200
Subject[PATCH 1/1] net: caif: use correct format specifier
Message-ID<s0Tm9-5w0-1@gated-at.bofh.it>
%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

[toc] | [next] | [standalone]


#1453473

FromDavid Miller <davem@davemloft.net>
Date2016-08-01 23:00 +0200
Message-ID<s1stz-32g-17@gated-at.bofh.it>
In reply to#1452780
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.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web