]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fincore: make sure mmap(NULL, ...) [coverity scan]
authorKarel Zak <kzak@redhat.com>
Thu, 12 Oct 2017 10:44:55 +0000 (12:44 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 12 Oct 2017 10:44:55 +0000 (12:44 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/fincore.c

index f1596a7366da6390b7a6c6814bab8c76fcdf4db7..4641408f89382d42d5d9b283294a6db9cbca3a38 100644 (file)
@@ -194,13 +194,13 @@ static int fincore_fd (struct fincore_control *ctl,
                       off_t *count_incore)
 {
        size_t window_size = N_PAGES_IN_WINDOW * ctl->pagesize;
-       off_t  file_offset;
-       void  *window = NULL;
+       off_t file_offset;
        int rc = 0;
        int warned_once = 0;
 
        for (file_offset = 0; file_offset < file_size; file_offset += window_size) {
                size_t len;
+               void  *window = NULL;
 
                len = file_size - file_offset;
                if (len >= window_size)