Index: uspace/app/bdwrite/bdwrite.c
===================================================================
--- uspace/app/bdwrite/bdwrite.c	(revision 6124ee1520304f778039d7422108bb55b56b921c)
+++ uspace/app/bdwrite/bdwrite.c	(revision bf0a79165b9ed48ab71bc06b9cc9a53949a8c8ed)
@@ -108,5 +108,5 @@
 
 	uint64_t to_alloc = min(DATA_XFER_LIMIT, bsize * blkcnt);
-	uint8_t *buf = calloc(to_alloc / bsize, bsize);
+	uint8_t *buf = malloc(to_alloc);
 	if (buf == NULL) {
 		rc = ENOMEM;
@@ -114,5 +114,5 @@
 	}
 	uint64_t left = blkcnt;
-	while (left > 0) {
+	while (left != 0) {
 		uint64_t blks_to_write = min(to_alloc / bsize, left);
 		uint8_t *ptr = buf;
@@ -120,5 +120,5 @@
 			/* memset(ptr, (i + 1) % 0x100, bsize); */
 			memset(ptr, 'A' + (i % 26), bsize);
-			ptr = (uint8_t *)((uintptr_t) ptr + bsize);
+			ptr += bsize;
 		}
 		rc = block_write_direct(dev, off, blks_to_write, buf);
@@ -128,4 +128,5 @@
 		}
 		left -= blks_to_write;
+		off += blks_to_write;
 	}
 end:
