Skip to content

Commit eee8c61

Browse files
committed
Suppress sparse warning
Reported by sparse: examples/cryptosk.c: In function ‘test_skcipher_encrypt’: examples/cryptosk.c:121:35: error: passing argument 3 of ‘skcipher_request_set_callback’ from incompatible pointer type [-Werror=incompatible-pointer-types] 121 | test_skcipher_callback, &sk->result); | ^~~~~~~~~~~~~~~~~~~~~~ | | | void (*)(struct crypto_async_request *, int) In file included from ./include/crypto/internal/skcipher.h:13, from examples/cryptosk.c:4: ./include/crypto/skcipher.h:576:70: note: expected ‘crypto_completion_t’ {aka ‘void (*)(void *, int)’} but argument is of type ‘void (*)(struct crypto_async_request *, int)’ 576 | crypto_completion_t compl, | ~~~~~~~~~~~~~~~~~~~~^~~~~ cc1: some warnings being treated as errors
1 parent 1d38d2e commit eee8c61

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

examples/cryptosk.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ static int test_skcipher_encrypt(char *plaintext, char *password,
9999
{
100100
int ret = -EFAULT;
101101
unsigned char key[SYMMETRIC_KEY_LENGTH];
102+
crypto_completion_t compl ;
102103

103104
if (!sk->tfm) {
104105
sk->tfm = crypto_alloc_skcipher("cbc-aes-aesni", 0, 0);
@@ -117,8 +118,9 @@ static int test_skcipher_encrypt(char *plaintext, char *password,
117118
}
118119
}
119120

120-
skcipher_request_set_callback(sk->req, CRYPTO_TFM_REQ_MAY_BACKLOG,
121-
test_skcipher_callback, &sk->result);
121+
compl = (crypto_completion_t)test_skcipher_callback;
122+
skcipher_request_set_callback(sk->req, CRYPTO_TFM_REQ_MAY_BACKLOG, compl,
123+
&sk->result);
122124

123125
/* clear the key */
124126
memset((void *)key, '\0', SYMMETRIC_KEY_LENGTH);

0 commit comments

Comments
 (0)