From 72730c8119f088f39e6ad8c5b0dde446a3940578 Mon Sep 17 00:00:00 2001 From: Robert Spalek Date: Tue, 3 Feb 2009 21:09:27 -0800 Subject: [PATCH] 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. --- ucw/partmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.39.2