Skip to content

Commit

Permalink
iomap: iomap_bmap should check iomap_apply return value
Browse files Browse the repository at this point in the history
Coverity caught this fairly minor bug, but we should check the return
value of iomap_apply regardless.

Coverity-id: 1437065
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
  • Loading branch information
Darrick J. Wong committed Nov 8, 2019
1 parent add66fc commit 2b91b28
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fs/iomap/fiemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,16 @@ iomap_bmap(struct address_space *mapping, sector_t bno,
struct inode *inode = mapping->host;
loff_t pos = bno << inode->i_blkbits;
unsigned blocksize = i_blocksize(inode);
int ret;

if (filemap_write_and_wait(mapping))
return 0;

bno = 0;
iomap_apply(inode, pos, blocksize, 0, ops, &bno, iomap_bmap_actor);
ret = iomap_apply(inode, pos, blocksize, 0, ops, &bno,
iomap_bmap_actor);
if (ret)
return 0;
return bno;
}
EXPORT_SYMBOL_GPL(iomap_bmap);

0 comments on commit 2b91b28

Please sign in to comment.