diff options
author | Andreas Gruenbacher <agruenba@redhat.com> | 2018-07-06 18:05:41 -0400 |
---|---|---|
committer | Andreas Gruenbacher <agruenba@redhat.com> | 2018-07-24 18:06:48 -0400 |
commit | c25892827c7996eb19ca2a5b1cf596218122e994 (patch) | |
tree | 1210ec633eea5ea734e041e8c52e132c51c18801 | |
parent | 4a7727725dc7d73769c5ab24c566df454093285f (diff) |
gfs2: fallocate_chunk: Always initialize struct iomap
In fallocate_chunk, always initialize the iomap before calling
gfs2_iomap_get_alloc: future changes could otherwise cause things like
iomap.flags to leak across calls.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: Bob Peterson <rpeterso@redhat.com>
-rw-r--r-- | fs/gfs2/file.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index f3c6d78659b1..6d895d39158a 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c | |||
@@ -877,7 +877,6 @@ static int fallocate_chunk(struct inode *inode, loff_t offset, loff_t len, | |||
877 | struct gfs2_inode *ip = GFS2_I(inode); | 877 | struct gfs2_inode *ip = GFS2_I(inode); |
878 | loff_t end = offset + len; | 878 | loff_t end = offset + len; |
879 | struct buffer_head *dibh; | 879 | struct buffer_head *dibh; |
880 | struct iomap iomap = { }; | ||
881 | int error; | 880 | int error; |
882 | 881 | ||
883 | error = gfs2_meta_inode_buffer(ip, &dibh); | 882 | error = gfs2_meta_inode_buffer(ip, &dibh); |
@@ -893,6 +892,8 @@ static int fallocate_chunk(struct inode *inode, loff_t offset, loff_t len, | |||
893 | } | 892 | } |
894 | 893 | ||
895 | while (offset < end) { | 894 | while (offset < end) { |
895 | struct iomap iomap = { }; | ||
896 | |||
896 | error = gfs2_iomap_get_alloc(inode, offset, end - offset, | 897 | error = gfs2_iomap_get_alloc(inode, offset, end - offset, |
897 | &iomap); | 898 | &iomap); |
898 | if (error) | 899 | if (error) |