Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: qce - fix sparse warnings

Fix few sparse warnings of type:
- sparse: incorrect type in argument
- sparse: incorrect type in initializer

Signed-off-by: Stanimir Varbanov <svarbanov@mm-sol.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Stanimir Varbanov and committed by
Herbert Xu
58a6535f 178f827a

+20 -17
+9 -6
drivers/crypto/qce/common.c
··· 201 201 unsigned int xtsklen = enckeylen / (2 * sizeof(u32)); 202 202 unsigned int xtsdusize; 203 203 204 - qce_cpu_to_be32p_array(xtskey, enckey + enckeylen / 2, enckeylen / 2); 204 + qce_cpu_to_be32p_array((__be32 *)xtskey, enckey + enckeylen / 2, 205 + enckeylen / 2); 205 206 qce_write_array(qce, REG_ENCR_XTS_KEY0, xtskey, xtsklen); 206 207 207 208 /* xts du size 512B */ ··· 263 262 u32 authkey_words = rctx->authklen / sizeof(u32); 264 263 265 264 qce_cpu_to_be32p_array(mackey, rctx->authkey, rctx->authklen); 266 - qce_write_array(qce, REG_AUTH_KEY0, mackey, authkey_words); 265 + qce_write_array(qce, REG_AUTH_KEY0, (u32 *)mackey, 266 + authkey_words); 267 267 } 268 268 269 269 if (IS_CMAC(rctx->flags)) ··· 276 274 qce_cpu_to_be32p_array(auth, rctx->digest, digestsize); 277 275 278 276 iv_words = (IS_SHA1(rctx->flags) || IS_SHA1_HMAC(rctx->flags)) ? 5 : 8; 279 - qce_write_array(qce, REG_AUTH_IV0, auth, iv_words); 277 + qce_write_array(qce, REG_AUTH_IV0, (u32 *)auth, iv_words); 280 278 281 279 if (rctx->first_blk) 282 280 qce_clear_array(qce, REG_AUTH_BYTECNT0, 4); 283 281 else 284 - qce_write_array(qce, REG_AUTH_BYTECNT0, rctx->byte_count, 2); 282 + qce_write_array(qce, REG_AUTH_BYTECNT0, 283 + (u32 *)rctx->byte_count, 2); 285 284 286 285 auth_cfg = qce_auth_cfg(rctx->flags, 0); 287 286 ··· 357 354 return -EINVAL; 358 355 } 359 356 360 - qce_write_array(qce, REG_ENCR_KEY0, enckey, enckey_words); 357 + qce_write_array(qce, REG_ENCR_KEY0, (u32 *)enckey, enckey_words); 361 358 362 359 if (!IS_ECB(flags)) { 363 360 if (IS_XTS(flags)) ··· 365 362 else 366 363 qce_cpu_to_be32p_array(enciv, rctx->iv, ivsize); 367 364 368 - qce_write_array(qce, REG_CNTR0_IV0, enciv, enciv_words); 365 + qce_write_array(qce, REG_CNTR0_IV0, (u32 *)enciv, enciv_words); 369 366 } 370 367 371 368 if (IS_ENCRYPT(flags))
+1 -1
drivers/crypto/qce/common.h
··· 85 85 struct list_head entry; 86 86 u32 crypto_alg_type; 87 87 unsigned long alg_flags; 88 - const __be32 *std_iv; 88 + const u32 *std_iv; 89 89 union { 90 90 struct crypto_alg crypto; 91 91 struct ahash_alg ahash;
+10 -10
drivers/crypto/qce/sha.c
··· 25 25 26 26 static LIST_HEAD(ahash_algs); 27 27 28 - static const __be32 std_iv_sha1[SHA256_DIGEST_SIZE / sizeof(__be32)] = { 28 + static const u32 std_iv_sha1[SHA256_DIGEST_SIZE / sizeof(u32)] = { 29 29 SHA1_H0, SHA1_H1, SHA1_H2, SHA1_H3, SHA1_H4, 0, 0, 0 30 30 }; 31 31 32 - static const __be32 std_iv_sha256[SHA256_DIGEST_SIZE / sizeof(__be32)] = { 32 + static const u32 std_iv_sha256[SHA256_DIGEST_SIZE / sizeof(u32)] = { 33 33 SHA256_H0, SHA256_H1, SHA256_H2, SHA256_H3, 34 34 SHA256_H4, SHA256_H5, SHA256_H6, SHA256_H7 35 35 }; ··· 132 132 { 133 133 struct qce_sha_reqctx *rctx = ahash_request_ctx(req); 134 134 struct qce_alg_template *tmpl = to_ahash_tmpl(req->base.tfm); 135 - const __be32 *std_iv = tmpl->std_iv; 135 + const u32 *std_iv = tmpl->std_iv; 136 136 137 137 memset(rctx, 0, sizeof(*rctx)); 138 138 rctx->first_blk = true; ··· 156 156 struct sha1_state *out_state = out; 157 157 158 158 out_state->count = rctx->count; 159 - qce_cpu_to_be32p_array(out_state->state, rctx->digest, 160 - digestsize); 159 + qce_cpu_to_be32p_array((__be32 *)out_state->state, 160 + rctx->digest, digestsize); 161 161 memcpy(out_state->buffer, rctx->buf, blocksize); 162 162 } else if (IS_SHA256(flags) || IS_SHA256_HMAC(flags)) { 163 163 struct sha256_state *out_state = out; 164 164 165 165 out_state->count = rctx->count; 166 - qce_cpu_to_be32p_array(out_state->state, rctx->digest, 167 - digestsize); 166 + qce_cpu_to_be32p_array((__be32 *)out_state->state, 167 + rctx->digest, digestsize); 168 168 memcpy(out_state->buf, rctx->buf, blocksize); 169 169 } else { 170 170 return -EINVAL; ··· 199 199 count += SHA_PADDING; 200 200 } 201 201 202 - rctx->byte_count[0] = (__be32)(count & ~SHA_PADDING_MASK); 203 - rctx->byte_count[1] = (__be32)(count >> 32); 202 + rctx->byte_count[0] = (__force __be32)(count & ~SHA_PADDING_MASK); 203 + rctx->byte_count[1] = (__force __be32)(count >> 32); 204 204 qce_cpu_to_be32p_array((__be32 *)rctx->digest, (const u8 *)state, 205 205 digestsize); 206 206 rctx->buflen = (unsigned int)(in_count & (blocksize - 1)); ··· 454 454 unsigned int digestsize; 455 455 unsigned int blocksize; 456 456 unsigned int statesize; 457 - const __be32 *std_iv; 457 + const u32 *std_iv; 458 458 }; 459 459 460 460 static const struct qce_ahash_def ahash_def[] = {