nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0296-btrfs-avoid-used-uninitialized-error-with-GCC7.patch

b1bcb2
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
c4e390
From: Andrei Borzenkov <arvidjaar@gmail.com>
c4e390
Date: Tue, 4 Apr 2017 19:22:32 +0300
b1bcb2
Subject: [PATCH] btrfs: avoid "used uninitialized" error with GCC7
c4e390
c4e390
sblock was local and so considered new variable on every loop
c4e390
iteration.
c4e390
c4e390
Upstream-commit-id: 6cef7f60795
c4e390
---
c4e390
 grub-core/fs/btrfs.c | 2 +-
c4e390
 1 file changed, 1 insertion(+), 1 deletion(-)
c4e390
c4e390
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
c4e390
index 4a6efffeb46..24a71045025 100644
c4e390
--- a/grub-core/fs/btrfs.c
c4e390
+++ b/grub-core/fs/btrfs.c
c4e390
@@ -227,11 +227,11 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data,
c4e390
 static grub_err_t
c4e390
 read_sblock (grub_disk_t disk, struct grub_btrfs_superblock *sb)
c4e390
 {
c4e390
+  struct grub_btrfs_superblock sblock;
c4e390
   unsigned i;
c4e390
   grub_err_t err = GRUB_ERR_NONE;
c4e390
   for (i = 0; i < ARRAY_SIZE (superblock_sectors); i++)
c4e390
     {
c4e390
-      struct grub_btrfs_superblock sblock;
c4e390
       /* Don't try additional superblocks beyond device size.  */
c4e390
       if (i && (grub_le_to_cpu64 (sblock.this_device.size)
c4e390
 		>> GRUB_DISK_SECTOR_BITS) <= superblock_sectors[i])