|
|
|
|
|
by actionfromafar
922 days ago
|
|
I still don't get it. Shouldn't [9] always evaluate to false, and the code be equivalent to: pins = mallocarray(npins, sizeof(int), M_PINSYSCALL, M_WAITOK|M_ZERO);
for (i = 0; i < nsyscalls; i++) {
pins[syscalls[i].sysno] = syscalls[i].offset;
}
Edit:Hang on - npins is already checked in the loop before, and incremented with ++ syscalls[i].sysno can't be larger than what is allocated with: pins = mallocarray(npins, sizeof(int), M_PINSYSCALL, M_WAITOK|M_ZERO); So I still can't find the problem |
|
When we loop through, we'll set:
Now when we come to 3, we'll find `pin[syscalls[2].sysno] != 0` since `syscalls[2].sysno == syscalls[0].sysno` - so we set `pin[1] = -1` instead of `0x9abc`.