> > > > /* Apply to left of object. */ > > - for (addr = pageaddr; addr < meta->addr; addr++) { > > - if (!fn((u8 *)addr)) > > + for (; meta->addr - addr >= sizeof(u64); addr += sizeof(u64)) { > > + if (unlikely(*((u64 *)addr) != KFENCE_CANARY_PATTERN_U64)) > > break; > > } > I am confused. Right now this loop either runs from pageaddr to > meta_addr if there's no corruption, or breaks at the first corrupted > byte. > Regardless of that, we are applying check_canary_byte() to every byte > of that range in the following loop. > Shouldn't the two be nested, like in the case of the canary bytes to > the right of the object? > Please disregard my comment. This loop is fine, it just speeds up finding the first corrupted byte.