From: Robert Spalek Date: Wed, 4 Feb 2009 05:09:27 +0000 (-0800) Subject: fix partmap_load() on amd64 with CONFIG_PARTMAP_IS_MMAP X-Git-Tag: holmes-import~118^2~2 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=72730c8119f088f39e6ad8c5b0dde446a3940578;p=libucw.git fix partmap_load() on amd64 with CONFIG_PARTMAP_IS_MMAP 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. --- diff --git a/ucw/partmap.c b/ucw/partmap.c index 962b04bf..93a7e1ba 100644 --- a/ucw/partmap.c +++ b/ucw/partmap.c @@ -69,7 +69,7 @@ partmap_load(struct partmap *p, ucw_off_t start, uns size) 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);