opuntiaOS - an operating system targeting x86 and ARMv7
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[kernel][algo] Fix bitmap

+5 -5
+5 -5
kernel/kernel/algo/bitmap.c
··· 140 140 { 141 141 int taken = 0; 142 142 int start = 0; 143 - for (int i = 0; i < bitmap.len; i++) { 143 + for (int i = 0; i < bitmap.len / 8; i++) { 144 144 if (bitmap.data[i] == 0xff) { 145 145 taken = 0; 146 146 continue; ··· 166 166 167 167 int bitmap_set(bitmap_t bitmap, int where) 168 168 { 169 - if (where >= bitmap.len * BITMAP_BLOCKS_PER_BYTE) { 169 + if (where >= bitmap.len) { 170 170 return -EFAULT; 171 171 } 172 172 ··· 179 179 180 180 int bitmap_unset(bitmap_t bitmap, int where) 181 181 { 182 - if (where >= bitmap.len * BITMAP_BLOCKS_PER_BYTE) { 182 + if (where >= bitmap.len) { 183 183 return -EFAULT; 184 184 } 185 185 ··· 192 192 193 193 int bitmap_set_range(bitmap_t bitmap, int start, int len) 194 194 { 195 - if (start + len - 1 >= bitmap.len * BITMAP_BLOCKS_PER_BYTE) { 195 + if (start + len - 1 >= bitmap.len) { 196 196 return -EFAULT; 197 197 } 198 198 ··· 222 222 223 223 int bitmap_unset_range(bitmap_t bitmap, int start, int len) 224 224 { 225 - if (start + len - 1 >= bitmap.len * BITMAP_BLOCKS_PER_BYTE) { 225 + if (start + len - 1 >= bitmap.len) { 226 226 return -EFAULT; 227 227 } 228 228