I don't understand how this could ever have worked. the left-hand side is -1
and is never larger than right-hand side when comparing signed values.
ucw_off_t end = start + size;
ucw_off_t win_start = start/CPU_PAGE_SIZE * CPU_PAGE_SIZE;
size_t win_len = PARTMAP_WINDOW;
- if ((ucw_off_t) (win_start+win_len) > p->file_size)
+ if (win_len > p->file_size - win_start)
win_len = ALIGN_TO(p->file_size - win_start, CPU_PAGE_SIZE);
if ((ucw_off_t) (win_start+win_len) < end)
die("partmap_map: Window is too small for mapping %d bytes", size);