diff options
author | Phil Sutter <phil.sutter@viprinet.com> | 2010-06-17 11:40:07 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2010-06-17 20:27:51 +0200 |
commit | e3942824795b23cb6e09eb050e63fdb623d7ae75 (patch) | |
tree | 3dfdebb0e461e64d0138a7c8791168dda95f84c3 /cryptodev_main.c | |
parent | a218e72b38e3468b1b3ecfaf65e68eeca7c3cf98 (diff) | |
download | kernel-crypto-e3942824795b23cb6e09eb050e63fdb623d7ae75.tar.gz kernel-crypto-e3942824795b23cb6e09eb050e63fdb623d7ae75.tar.xz kernel-crypto-e3942824795b23cb6e09eb050e63fdb623d7ae75.zip |
*_to_compat, compat_to_*: fix different size pointer casting
In order to warning-free convert a 32bit integer into a 64bit pointer,
casting in two steps is needed: first to adjust the variable size to
64bit, then to actually convert the integer into a pointer. The other
direction is easier: after converting the pointer to an integer,
assignment to a smaller variable can be done without warning.
Diffstat (limited to 'cryptodev_main.c')
-rw-r--r-- | cryptodev_main.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/cryptodev_main.c b/cryptodev_main.c index 858970b39bf..291627f680f 100644 --- a/cryptodev_main.c +++ b/cryptodev_main.c @@ -586,9 +586,9 @@ static inline void compat_to_session_op(struct compat_session_op *compat, struct session_op *sop) { memcpy(sop, compat, sizeof(uint32_t) * 3); - sop->key = (uint8_t *)compat->key; + sop->key = (uint8_t *)(unsigned long)compat->key; sop->mackeylen = compat->mackeylen; - sop->mackey = (uint8_t *)compat->mackey; + sop->mackey = (uint8_t *)(unsigned long)compat->mackey; sop->ses = compat->ses; } @@ -596,9 +596,9 @@ static inline void session_op_to_compat(struct session_op *sop, struct compat_session_op *compat) { memcpy(compat, sop, sizeof(uint32_t) * 3); - compat->key = (uint32_t)sop->key; + compat->key = (unsigned long)sop->key; compat->mackeylen = sop->mackeylen; - compat->mackey = (uint32_t)sop->mackey; + compat->mackey = (unsigned long)sop->mackey; compat->ses = sop->ses; } @@ -606,20 +606,20 @@ static inline void compat_to_crypto_op(struct compat_crypt_op *compat, struct crypt_op *cop) { memcpy(cop, compat, sizeof(uint32_t) * 2 + sizeof(uint16_t) * 2); - cop->src = (uint8_t *)compat->src; - cop->dst = (uint8_t *)compat->dst; - cop->mac = (uint8_t *)compat->mac; - cop->iv = (uint8_t *)compat->iv; + cop->src = (uint8_t *)(unsigned long)compat->src; + cop->dst = (uint8_t *)(unsigned long)compat->dst; + cop->mac = (uint8_t *)(unsigned long)compat->mac; + cop->iv = (uint8_t *)(unsigned long)compat->iv; } static inline void crypto_op_to_compat(struct crypt_op *cop, struct compat_crypt_op *compat) { memcpy(compat, cop, sizeof(uint32_t) * 2 + sizeof(uint16_t) * 2); - compat->src = (uint32_t)cop->src; - compat->dst = (uint32_t)cop->dst; - compat->mac = (uint32_t)cop->mac; - compat->iv = (uint32_t)cop->iv; + compat->src = (unsigned long)cop->src; + compat->dst = (unsigned long)cop->dst; + compat->mac = (unsigned long)cop->mac; + compat->iv = (unsigned long)cop->iv; } static long |