- /*
- * 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;
+ if (sizeof(buf) != sizeof(cb->aio_buf)) {
+ /*
+ * The pointer has to be converted to 32 bit unsigned value first
+ * to avoid sign extension on cast to 64 bit value
+ */
+ cb->aio_buf = (uint64_t)(unsigned long)buf;
+ } else {
+ cb->aio_buf = (uint64_t)buf;
+ }