[PATCH] staging: ccree: fixed pointer signedness warnings.

Jeremy Sowden jeremy at azazel.net
Thu Dec 21 11:25:47 UTC 2017


Changed the types of a number of index and length variables from int to
unsigned int.  Fixes a number of warnings arising from their addresses
being passed to functions expecting pointers to unsigned ints.

Signed-off-by: Jeremy Sowden <jeremy at azazel.net>
---
 drivers/staging/ccree/ssi_aead.c       | 13 ++++++++-----
 drivers/staging/ccree/ssi_buffer_mgr.c |  2 +-
 drivers/staging/ccree/ssi_cipher.c     |  3 ++-
 drivers/staging/ccree/ssi_hash.c       | 15 ++++++++-------
 4 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c
index 1522b00e08cf..638e3b515a1f 100644
--- a/drivers/staging/ccree/ssi_aead.c
+++ b/drivers/staging/ccree/ssi_aead.c
@@ -275,7 +275,8 @@ static void cc_aead_complete(struct device *dev, void *cc_req)
 	aead_request_complete(areq, err);
 }
 
-static int xcbc_setkey(struct cc_hw_desc *desc, struct cc_aead_ctx *ctx)
+static unsigned int xcbc_setkey
+	(struct cc_hw_desc *desc, struct cc_aead_ctx *ctx)
 {
 	/* Load the AES key */
 	hw_desc_init(&desc[0]);
@@ -315,7 +316,8 @@ static int xcbc_setkey(struct cc_hw_desc *desc, struct cc_aead_ctx *ctx)
 	return 4;
 }
 
-static int hmac_setkey(struct cc_hw_desc *desc, struct cc_aead_ctx *ctx)
+static unsigned int hmac_setkey
+	(struct cc_hw_desc *desc, struct cc_aead_ctx *ctx)
 {
 	unsigned int hmac_pad_const[2] = { HMAC_IPAD_CONST, HMAC_OPAD_CONST };
 	unsigned int digest_ofs = 0;
@@ -325,7 +327,7 @@ static int hmac_setkey(struct cc_hw_desc *desc, struct cc_aead_ctx *ctx)
 			CC_SHA1_DIGEST_SIZE : CC_SHA256_DIGEST_SIZE;
 	struct cc_hmac_s *hmac = &ctx->auth_state.hmac;
 
-	int idx = 0;
+	unsigned int idx = 0;
 	int i;
 
 	/* calc derived HMAC key */
@@ -562,7 +564,8 @@ cc_aead_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen)
 	struct cc_crypto_req cc_req = {};
 	struct crypto_authenc_key_param *param;
 	struct cc_hw_desc desc[MAX_AEAD_SETKEY_SEQ];
-	int seq_len = 0, rc = -EINVAL;
+	unsigned int seq_len = 0;
+	int rc = -EINVAL;
 	struct device *dev = drvdata_to_dev(ctx->drvdata);
 
 	dev_dbg(dev, "Setting key in context @%p for %s. key=%p keylen=%u\n",
@@ -1901,7 +1904,7 @@ static int cc_proc_aead(struct aead_request *req,
 			enum drv_crypto_direction direct)
 {
 	int rc = 0;
-	int seq_len = 0;
+	unsigned int seq_len = 0;
 	struct cc_hw_desc desc[MAX_AEAD_PROCESS_SEQ];
 	struct crypto_aead *tfm = crypto_aead_reqtfm(req);
 	struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm);
diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c
index 6846d93e22c4..6056a5d2a5b0 100644
--- a/drivers/staging/ccree/ssi_buffer_mgr.c
+++ b/drivers/staging/ccree/ssi_buffer_mgr.c
@@ -1036,7 +1036,7 @@ static int cc_aead_chain_data(struct cc_drvdata *drvdata,
 	struct device *dev = drvdata_to_dev(drvdata);
 	enum drv_crypto_direction direct = areq_ctx->gen_ctx.op_type;
 	unsigned int authsize = areq_ctx->req_authsize;
-	int src_last_bytes = 0, dst_last_bytes = 0;
+	u32 src_last_bytes = 0, dst_last_bytes = 0;
 	int rc = 0;
 	u32 src_mapped_nents = 0, dst_mapped_nents = 0;
 	u32 offset = 0;
diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c
index db21570a13a6..3885a50cc035 100644
--- a/drivers/staging/ccree/ssi_cipher.c
+++ b/drivers/staging/ccree/ssi_cipher.c
@@ -651,7 +651,8 @@ static int cc_cipher_process(struct ablkcipher_request *req,
 	struct device *dev = drvdata_to_dev(ctx_p->drvdata);
 	struct cc_hw_desc desc[MAX_ABLKCIPHER_SEQ_LEN];
 	struct cc_crypto_req cc_req = {};
-	int rc, seq_len = 0, cts_restore_flag = 0;
+	int rc, cts_restore_flag = 0;
+	unsigned int seq_len = 0;
 
 	dev_dbg(dev, "%s req=%p info=%p nbytes=%d\n",
 		((direction == DRV_CRYPTO_DIRECTION_ENCRYPT) ?
diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c
index 882f1c12d85e..edf6b54fde31 100644
--- a/drivers/staging/ccree/ssi_hash.c
+++ b/drivers/staging/ccree/ssi_hash.c
@@ -429,7 +429,7 @@ static int cc_hash_digest(struct ahash_request *req)
 	struct cc_hw_desc desc[CC_MAX_HASH_SEQ_LEN];
 	cc_sram_addr_t larval_digest_addr =
 		cc_larval_digest_addr(ctx->drvdata, ctx->hash_mode);
-	int idx = 0;
+	unsigned int idx = 0;
 	int rc = 0;
 
 	dev_dbg(dev, "===== %s-digest (%d) ====\n", is_hmac ? "hmac" : "hash",
@@ -667,7 +667,7 @@ static int cc_hash_finup(struct ahash_request *req)
 	bool is_hmac = ctx->is_hmac;
 	struct cc_crypto_req cc_req = {};
 	struct cc_hw_desc desc[CC_MAX_HASH_SEQ_LEN];
-	int idx = 0;
+	unsigned int idx = 0;
 	int rc;
 
 	dev_dbg(dev, "===== %s-finup (%d) ====\n", is_hmac ? "hmac" : "hash",
@@ -787,7 +787,7 @@ static int cc_hash_final(struct ahash_request *req)
 	bool is_hmac = ctx->is_hmac;
 	struct cc_crypto_req cc_req = {};
 	struct cc_hw_desc desc[CC_MAX_HASH_SEQ_LEN];
-	int idx = 0;
+	unsigned int idx = 0;
 	int rc;
 
 	dev_dbg(dev, "===== %s-final (%d) ====\n", is_hmac ? "hmac" : "hash",
@@ -1113,7 +1113,8 @@ static int cc_xcbc_setkey(struct crypto_ahash *ahash,
 	struct cc_crypto_req cc_req = {};
 	struct cc_hash_ctx *ctx = crypto_ahash_ctx(ahash);
 	struct device *dev = drvdata_to_dev(ctx->drvdata);
-	int idx = 0, rc = 0;
+	unsigned int idx = 0;
+	int rc = 0;
 	struct cc_hw_desc desc[CC_MAX_HASH_SEQ_LEN];
 
 	dev_dbg(dev, "===== setkey (%d) ====\n", keylen);
@@ -1391,7 +1392,7 @@ static int cc_mac_final(struct ahash_request *req)
 	struct device *dev = drvdata_to_dev(ctx->drvdata);
 	struct cc_crypto_req cc_req = {};
 	struct cc_hw_desc desc[CC_MAX_HASH_SEQ_LEN];
-	int idx = 0;
+	unsigned int idx = 0;
 	int rc = 0;
 	u32 key_size, key_len;
 	u32 digestsize = crypto_ahash_digestsize(tfm);
@@ -1505,7 +1506,7 @@ static int cc_mac_finup(struct ahash_request *req)
 	struct device *dev = drvdata_to_dev(ctx->drvdata);
 	struct cc_crypto_req cc_req = {};
 	struct cc_hw_desc desc[CC_MAX_HASH_SEQ_LEN];
-	int idx = 0;
+	unsigned int idx = 0;
 	int rc = 0;
 	u32 key_len = 0;
 	u32 digestsize = crypto_ahash_digestsize(tfm);
@@ -1579,7 +1580,7 @@ static int cc_mac_digest(struct ahash_request *req)
 	struct cc_crypto_req cc_req = {};
 	struct cc_hw_desc desc[CC_MAX_HASH_SEQ_LEN];
 	u32 key_len;
-	int idx = 0;
+	unsigned int idx = 0;
 	int rc;
 
 	dev_dbg(dev, "===== -digest mac (%d) ====\n",  req->nbytes);
-- 
2.15.1



More information about the devel mailing list