iomap: fix WARN_ON_ONCE on uninitialized variable
authorDarrick J. Wong <darrick.wong@oracle.com>
Sat, 11 Aug 2018 00:55:57 +0000 (17:55 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Tue, 14 Aug 2018 15:17:02 +0000 (08:17 -0700)
In commit 9dc55f1389f9569 ("iomap: add support for sub-pagesize buffered
I/O without buffer heads") we moved the initialization of poff (it's
computed from pos) into a separate helper function.  Inline data only
ever deals with pos == 0, hence the WARN_ON_ONCE, but now we're testing
an uninitialized variable.

Therefore, change the test to check the parameter directly.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
fs/iomap.c

index 8bd54c08deee8c031dbccfe42004befa50b67c42..8a18163dc432444cbb36f8db4a585e9b0083a256 100644 (file)
@@ -290,7 +290,7 @@ iomap_readpage_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
        sector_t sector;
 
        if (iomap->type == IOMAP_INLINE) {
        sector_t sector;
 
        if (iomap->type == IOMAP_INLINE) {
-               WARN_ON_ONCE(poff);
+               WARN_ON_ONCE(pos);
                iomap_read_inline_data(inode, page, iomap);
                return PAGE_SIZE;
        }
                iomap_read_inline_data(inode, page, iomap);
                return PAGE_SIZE;
        }