Patch "btrfs: initialize start_slot in btrfs_log_prealloc_extents" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    btrfs: initialize start_slot in btrfs_log_prealloc_extents

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     btrfs-initialize-start_slot-in-btrfs_log_prealloc_ex.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 36424ad6f74cc330ae8c12d1afded8b2f8186139
Author: Josef Bacik <josef@xxxxxxxxxxxxxx>
Date:   Tue Sep 5 12:15:24 2023 -0400

    btrfs: initialize start_slot in btrfs_log_prealloc_extents
    
    [ Upstream commit b4c639f699349880b7918b861e1bd360442ec450 ]
    
    Jens reported a compiler warning when using
    CONFIG_CC_OPTIMIZE_FOR_SIZE=y that looks like this
    
      fs/btrfs/tree-log.c: In function ‘btrfs_log_prealloc_extents’:
      fs/btrfs/tree-log.c:4828:23: warning: ‘start_slot’ may be used
      uninitialized [-Wmaybe-uninitialized]
       4828 |                 ret = copy_items(trans, inode, dst_path, path,
            |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       4829 |                                  start_slot, ins_nr, 1, 0);
            |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~
      fs/btrfs/tree-log.c:4725:13: note: ‘start_slot’ was declared here
       4725 |         int start_slot;
            |             ^~~~~~~~~~
    
    The compiler is incorrect, as we only use this code when ins_len > 0,
    and when ins_len > 0 we have start_slot properly initialized.  However
    we generally find the -Wmaybe-uninitialized warnings valuable, so
    initialize start_slot to get rid of the warning.
    
    Reported-by: Jens Axboe <axboe@xxxxxxxxx>
    Tested-by: Jens Axboe <axboe@xxxxxxxxx>
    Signed-off-by: Josef Bacik <josef@xxxxxxxxxxxxxx>
    Reviewed-by: David Sterba <dsterba@xxxxxxxx>
    Signed-off-by: David Sterba <dsterba@xxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 926b1d34e55cc..f75333d7b78a5 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -4283,7 +4283,7 @@ static int btrfs_log_prealloc_extents(struct btrfs_trans_handle *trans,
 	struct extent_buffer *leaf;
 	int slot;
 	int ins_nr = 0;
-	int start_slot;
+	int start_slot = 0;
 	int ret;
 
 	if (!(inode->flags & BTRFS_INODE_PREALLOC))



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux