2023-10-25 11:57:28

by Dan Carpenter

[permalink] [raw]
Subject: [PATCH] gfs2: uninitialized variable in __gfs2_iomap_get()

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 <[email protected]>
---
fs/gfs2/bmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

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;
--
2.42.0


2023-10-25 12:37:11

by Andreas Gruenbacher

[permalink] [raw]
Subject: Re: [PATCH] gfs2: uninitialized variable in __gfs2_iomap_get()

Dan,

On Wed, Oct 25, 2023 at 1:57 PM Dan Carpenter <[email protected]> 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