diff --git a/linux_spi.c b/linux_spi.c
index fa6ec17135c145d1f027a121d909c2cb55280592..d12075411f632e898e57ae32f63199bd2564283f 100644
--- a/linux_spi.c
+++ b/linux_spi.c
@@ -107,11 +107,11 @@ static int linux_spi_send_command(unsigned int writecnt, unsigned int readcnt,
 {
 	struct spi_ioc_transfer msg[2] = {
 		{
-			.tx_buf = (uint64_t)txbuf,
+			.tx_buf = (uint64_t)(ptrdiff_t)txbuf,
 			.len = writecnt,
 		},
 		{
-			.rx_buf = (uint64_t)rxbuf,
+			.rx_buf = (uint64_t)(ptrdiff_t)rxbuf,
 			.len = readcnt,
 		},
 	};