Changeset b56d88f in mainline


Ignore:
Timestamp:
2024-11-22T21:10:35Z (7 months ago)
Author:
Miroslav Cimerman <mc@…>
Children:
f81960c5
Parents:
b8409b9
Message:

bdwrite: fix writing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdwrite/bdwrite.c

    rb8409b9 rb56d88f  
    108108
    109109        uint64_t to_alloc = min(DATA_XFER_LIMIT, bsize * blkcnt);
    110         uint8_t *buf = calloc(to_alloc / bsize, bsize);
     110        uint8_t *buf = malloc(to_alloc);
    111111        if (buf == NULL) {
    112112                rc = ENOMEM;
     
    114114        }
    115115        uint64_t left = blkcnt;
    116         while (left > 0) {
     116        while (left != 0) {
    117117                uint64_t blks_to_write = min(to_alloc / bsize, left);
    118118                uint8_t *ptr = buf;
     
    120120                        /* memset(ptr, (i + 1) % 0x100, bsize); */
    121121                        memset(ptr, 'A' + (i % 26), bsize);
    122                         ptr = (uint8_t *)((uintptr_t) ptr + bsize);
     122                        ptr += bsize;
    123123                }
    124124                rc = block_write_direct(dev, off, blks_to_write, buf);
     
    128128                }
    129129                left -= blks_to_write;
     130                off += blks_to_write;
    130131        }
    131132end:
Note: See TracChangeset for help on using the changeset viewer.