Skip to content
Snippets Groups Projects
Commit 96b7da5f authored by Nickolai Zeldovich's avatar Nickolai Zeldovich
Browse files

do not run past the end of the disk!

[ cherry-picked de6075ff0978108daea1d658425bcb37663a98a0 ]

Conflicts:

	fs.c
parent f70ef994
No related branches found
No related tags found
No related merge requests found
......@@ -61,7 +61,7 @@ balloc(uint dev)
readsb(dev, &sb);
for(b = 0; b < sb.size; b += BPB){
bp = bread(dev, BBLOCK(b, sb.ninodes));
for(bi = 0; bi < BPB; bi++){
for(bi = 0; bi < BPB && bi < (sb.size - b); bi++){
m = 1 << (bi % 8);
if((bp->data[bi/8] & m) == 0){ // Is block free?
bp->data[bi/8] |= m; // Mark block in use on disk.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment