Add a comment for the added cast with explanation.
[openssl.git] / engines / afalg / e_afalg.c
index 2e7ce3455abc44059eb28082a88d2368368f7309..1766230ce8f664be13920dae1f54c379e25e5f23 100644 (file)
@@ -230,7 +230,11 @@ int afalg_fin_cipher_aio(afalg_aio *aio, int sfd, unsigned char *buf,
     memset(cb, '\0', sizeof(*cb));
     cb->aio_fildes = sfd;
     cb->aio_lio_opcode = IOCB_CMD_PREAD;
-    cb->aio_buf = (uint64_t)buf;
+    /*
+     * The pointer has to be converted to unsigned value first to avoid
+     * sign extension on cast to 64 bit value
+     */
+    cb->aio_buf = (uint64_t)(unsigned long)buf;
     cb->aio_offset = 0;
     cb->aio_data = 0;
     cb->aio_nbytes = len;