]> Git Repo - J-linux.git/commitdiff
btrfs: initialize return variable in cleanup_free_space_cache_v1
authorTom Rix <[email protected]>
Fri, 30 Apr 2021 18:06:55 +0000 (11:06 -0700)
committerDavid Sterba <[email protected]>
Tue, 4 May 2021 16:05:15 +0000 (18:05 +0200)
Static analysis reports this problem

  free-space-cache.c:3965:2: warning: Undefined or garbage value returned
    return ret;
    ^~~~~~~~~~

ret is set in the node handling loop.  Treat doing nothing as a success
and initialize ret to 0, although it's unlikely the loop would be
skipped. We always have block groups, but as it could lead to
transaction abort in the caller it's better to be safe.

CC: [email protected] # 5.12+
Signed-off-by: Tom Rix <[email protected]>
Reviewed-by: David Sterba <[email protected]>
Signed-off-by: David Sterba <[email protected]>
fs/btrfs/free-space-cache.c

index e54466fc101f775a46c04dca21c559ee00986b1c..4806295116d884c510b479569c53a865c326b556 100644 (file)
@@ -3949,7 +3949,7 @@ static int cleanup_free_space_cache_v1(struct btrfs_fs_info *fs_info,
 {
        struct btrfs_block_group *block_group;
        struct rb_node *node;
-       int ret;
+       int ret = 0;
 
        btrfs_info(fs_info, "cleaning free space cache v1");
 
This page took 0.063856 seconds and 4 git commands to generate.