linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: cavium/nitrox - Fix format strings
@ 2018-10-02 21:00 Arnd Bergmann
  2018-10-08  5:47 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2018-10-02 21:00 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller, Srikanth Jampala
  Cc: Arnd Bergmann, linux-crypto, linux-kernel

The return type of atomic64_read() is unfortunately architecture
specific, it can be 'long', 'long long', or 's64'. When it is 'long',
we get a build warning:

drivers/crypto/cavium/nitrox/nitrox_debugfs.c: In function 'stats_show':
drivers/crypto/cavium/nitrox/nitrox_debugfs.c:62:30: error: format '%lld' expects argument of type 'long long int', but argument 3 has type 'long int' [-Werror=format=]
  seq_printf(s, "  Posted: %lld\n", atomic64_read(&ndev->stats.posted));
                           ~~~^
                           %ld
drivers/crypto/cavium/nitrox/nitrox_debugfs.c:63:33: error: format '%lld' expects argument of type 'long long int', but argument 3 has type 'long int' [-Werror=format=]
  seq_printf(s, "  Completed: %lld\n",
                              ~~~^
                              %ld
drivers/crypto/cavium/nitrox/nitrox_debugfs.c:65:31: error: format '%lld' expects argument of type 'long long int', but argument 3 has type 'long int' [-Werror=format=]

Add an explicit cast to 's64' to get a consistent behavior on all
architectures here during compile testing.

Fixes: 2a8780be9c26 ("crypto: cavium/nitrox - updated debugfs information.")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/crypto/cavium/nitrox/nitrox_debugfs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/cavium/nitrox/nitrox_debugfs.c b/drivers/crypto/cavium/nitrox/nitrox_debugfs.c
index 2f1e74ea846e..c5be91e5034c 100644
--- a/drivers/crypto/cavium/nitrox/nitrox_debugfs.c
+++ b/drivers/crypto/cavium/nitrox/nitrox_debugfs.c
@@ -59,10 +59,10 @@ static int stats_show(struct seq_file *s, void *v)
 	struct nitrox_device *ndev = s->private;
 
 	seq_printf(s, "NITROX [%d] Request Statistics\n", ndev->idx);
-	seq_printf(s, "  Posted: %lld\n", atomic64_read(&ndev->stats.posted));
+	seq_printf(s, "  Posted: %lld\n", (s64)atomic64_read(&ndev->stats.posted));
 	seq_printf(s, "  Completed: %lld\n",
-		   atomic64_read(&ndev->stats.completed));
-	seq_printf(s, "  Dropped: %lld\n", atomic64_read(&ndev->stats.dropped));
+		   (s64)atomic64_read(&ndev->stats.completed));
+	seq_printf(s, "  Dropped: %lld\n", (s64)atomic64_read(&ndev->stats.dropped));
 
 	return 0;
 }
-- 
2.18.0


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

* Re: [PATCH] crypto: cavium/nitrox - Fix format strings
  2018-10-02 21:00 [PATCH] crypto: cavium/nitrox - Fix format strings Arnd Bergmann
@ 2018-10-08  5:47 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2018-10-08  5:47 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: David S. Miller, Srikanth Jampala, linux-crypto, linux-kernel

On Tue, Oct 02, 2018 at 11:00:03PM +0200, Arnd Bergmann wrote:
> The return type of atomic64_read() is unfortunately architecture
> specific, it can be 'long', 'long long', or 's64'. When it is 'long',
> we get a build warning:
> 
> drivers/crypto/cavium/nitrox/nitrox_debugfs.c: In function 'stats_show':
> drivers/crypto/cavium/nitrox/nitrox_debugfs.c:62:30: error: format '%lld' expects argument of type 'long long int', but argument 3 has type 'long int' [-Werror=format=]
>   seq_printf(s, "  Posted: %lld\n", atomic64_read(&ndev->stats.posted));
>                            ~~~^
>                            %ld
> drivers/crypto/cavium/nitrox/nitrox_debugfs.c:63:33: error: format '%lld' expects argument of type 'long long int', but argument 3 has type 'long int' [-Werror=format=]
>   seq_printf(s, "  Completed: %lld\n",
>                               ~~~^
>                               %ld
> drivers/crypto/cavium/nitrox/nitrox_debugfs.c:65:31: error: format '%lld' expects argument of type 'long long int', but argument 3 has type 'long int' [-Werror=format=]
> 
> Add an explicit cast to 's64' to get a consistent behavior on all
> architectures here during compile testing.
> 
> Fixes: 2a8780be9c26 ("crypto: cavium/nitrox - updated debugfs information.")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

This patch doesn't apply to cryptodev because the bug has already
been fixed by another patch.

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

end of thread, other threads:[~2018-10-08  5:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-02 21:00 [PATCH] crypto: cavium/nitrox - Fix format strings Arnd Bergmann
2018-10-08  5:47 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).