gfs2: uninitialized variable in __gfs2_iomap_get()

Message ID 0b9cb1ea-4656-4802-b7a7-811c1e9e118a@moroto.mountain
State New
Headers
Series gfs2: uninitialized variable in __gfs2_iomap_get() |

Commit Message

Dan Carpenter Oct. 25, 2023, 11:57 a.m. UTC
  The "ret" variable is uninitialized when we goto out because
gfs2_is_stuffed(ip).

Fixes: 2cd225820b91 ("gfs2: Initialize metapaths outside of __gfs2_iomap_get")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 fs/gfs2/bmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Andreas Gruenbacher Oct. 25, 2023, 12:35 p.m. UTC | #1
Dan,

On Wed, Oct 25, 2023 at 1:57 PM Dan Carpenter <dan.carpenter@linaro.org> wrote:
> The "ret" variable is uninitialized when we goto out because
> gfs2_is_stuffed(ip).
>
> Fixes: 2cd225820b91 ("gfs2: Initialize metapaths outside of __gfs2_iomap_get")

thanks for catching this. I've fixed that patch directly.

Andreas
  

Patch

diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index cef57d87c24d..12d7651e15e9 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -866,7 +866,7 @@  static int __gfs2_iomap_get(struct inode *inode, loff_t pos, loff_t length,
 	__be64 *ptr;
 	sector_t lblock;
 	sector_t lblock_stop;
-	int ret;
+	int ret = 0;
 	int eob;
 	u64 len;
 	struct buffer_head *bh;