From 6dfc79b030b4ea1d34e65eb75f25161e3038b134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Horia=20Geant=C4=83?= Date: Fri, 29 May 2015 10:22:07 +0300 Subject: crypto: caam - fix size_t print format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ARRAY_SIZE() returns a size_t value. Thus, when printing these values, %zu or %zx must be used, or else warnings show up: CC drivers/crypto/caam//caamalg.o In file included from include/linux/thread_info.h:11:0, from include/linux/preempt.h:9, from include/linux/spinlock.h:50, from include/linux/seqlock.h:35, from include/linux/time.h:5, from include/linux/stat.h:18, from include/linux/module.h:10, from drivers/crypto/caam//compat.h:9, from drivers/crypto/caam//caamalg.c:47: drivers/crypto/caam//caamalg.c: In function 'caam_cra_init': include/linux/bug.h:33:45: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=] #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) ^ include/linux/compiler-gcc.h:47:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO' #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) ^ include/linux/kernel.h:41:59: note: in expansion of macro '__must_be_array' #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) ^ drivers/crypto/caam//caamalg.c:4396:13: note: in expansion of macro 'ARRAY_SIZE' op_id, ARRAY_SIZE(digest_size)); ^ CC drivers/crypto/caam//caamhash.o In file included from include/linux/thread_info.h:11:0, from include/linux/preempt.h:9, from include/linux/spinlock.h:50, from include/linux/seqlock.h:35, from include/linux/time.h:5, from include/linux/stat.h:18, from include/linux/module.h:10, from drivers/crypto/caam//compat.h:9, from drivers/crypto/caam//caamhash.c:56: drivers/crypto/caam//caamhash.c: In function 'caam_hash_cra_init': include/linux/bug.h:33:45: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=] #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) ^ include/linux/compiler-gcc.h:47:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO' #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) ^ include/linux/kernel.h:41:59: note: in expansion of macro '__must_be_array' #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) ^ drivers/crypto/caam//caamhash.c:1782:12: note: in expansion of macro 'ARRAY_SIZE' op_id, ARRAY_SIZE(runninglen)); ^ Signed-off-by: Horia Geantă Change-Id: Ica005a337d654f7d55eea6f5e5aee911cbd016b2 Reviewed-on: http://git.am.freescale.net:8181/37071 Tested-by: Review Code-CDREVIEW Reviewed-by: Tudor-Dan Ambarus Reviewed-by: Honghua Yin diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c index ea44991..0f117d0 100644 --- a/drivers/crypto/caam/caamalg.c +++ b/drivers/crypto/caam/caamalg.c @@ -4392,7 +4392,7 @@ static int caam_cra_init(struct crypto_tfm *tfm) if (op_id < ARRAY_SIZE(digest_size)) { ctx->authsize = digest_size[op_id]; } else { - dev_err(ctx->jrdev, "incorrect op_id %d; must be less than %d\n", + dev_err(ctx->jrdev, "incorrect op_id %d; must be less than %zu\n", op_id, ARRAY_SIZE(digest_size)); caam_jr_free(ctx->jrdev); return -EINVAL; diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c index 697a683..e99a45b 100644 --- a/drivers/crypto/caam/caamhash.c +++ b/drivers/crypto/caam/caamhash.c @@ -1778,7 +1778,7 @@ static int caam_hash_cra_init(struct crypto_tfm *tfm) op_id = (ctx->alg_op & OP_ALG_ALGSEL_SUBMASK) >> OP_ALG_ALGSEL_SHIFT; if (op_id >= ARRAY_SIZE(runninglen)) { - dev_err(ctx->jrdev, "incorrect op_id %d; must be less than %d\n", + dev_err(ctx->jrdev, "incorrect op_id %d; must be less than %zu\n", op_id, ARRAY_SIZE(runninglen)); ret = -EINVAL; goto out_err; -- cgit v0.10.2