Blame SOURCES/0087-grub-core-commands-loadenv.c-check_blocklists-Fix-ov.patch

a85e8e
From 4895a5f05df22facb04bb1363fc63feff06a6ee0 Mon Sep 17 00:00:00 2001
a85e8e
From: =?UTF-8?q?=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD=20=D0=9F=D0=B5=D1=85=D0=BE?=
a85e8e
 =?UTF-8?q?=D0=B2?= <roman_pekhov>
a85e8e
Date: Sun, 22 Jun 2014 03:51:50 +0400
a85e8e
Subject: [PATCH 087/260] * grub-core/commands/loadenv.c (check_blocklists):
a85e8e
 Fix overlap check.
a85e8e
a85e8e
---
a85e8e
 ChangeLog                    |  4 ++++
a85e8e
 grub-core/commands/loadenv.c | 13 ++-----------
a85e8e
 2 files changed, 6 insertions(+), 11 deletions(-)
a85e8e
a85e8e
diff --git a/ChangeLog b/ChangeLog
a85e8e
index 4ce664327..a2da97432 100644
a85e8e
--- a/ChangeLog
a85e8e
+++ b/ChangeLog
a85e8e
@@ -1,3 +1,7 @@
a85e8e
+2014-06-21  Роман Пехов <roman_pekhov>
a85e8e
+
a85e8e
+	* grub-core/commands/loadenv.c (check_blocklists): Fix overlap check.
a85e8e
+
a85e8e
 2014-06-21  Glenn Washburn <development@efficientek.com>
a85e8e
 
a85e8e
 	* util/grub-install.c: Fix handling of --disk-module.
a85e8e
diff --git a/grub-core/commands/loadenv.c b/grub-core/commands/loadenv.c
a85e8e
index 6af811207..acd93d123 100644
a85e8e
--- a/grub-core/commands/loadenv.c
a85e8e
+++ b/grub-core/commands/loadenv.c
a85e8e
@@ -263,7 +263,7 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
a85e8e
       for (q = p->next; q; q = q->next)
a85e8e
         {
a85e8e
 	  grub_disk_addr_t s1, s2;
a85e8e
-	  grub_disk_addr_t e1, e2, t;
a85e8e
+	  grub_disk_addr_t e1, e2;
a85e8e
 
a85e8e
 	  s1 = p->sector;
a85e8e
 	  e1 = s1 + ((p->length + GRUB_DISK_SECTOR_SIZE - 1) >> GRUB_DISK_SECTOR_BITS);
a85e8e
@@ -271,16 +271,7 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
a85e8e
 	  s2 = q->sector;
a85e8e
 	  e2 = s2 + ((q->length + GRUB_DISK_SECTOR_SIZE - 1) >> GRUB_DISK_SECTOR_BITS);
a85e8e
 
a85e8e
-	  if (s2 > s1)
a85e8e
-	    {
a85e8e
-	      t = s2;
a85e8e
-	      s2 = s1;
a85e8e
-	      s1 = t;
a85e8e
-	      t = e2;
a85e8e
-	      e2 = e1;
a85e8e
-	      e1 = t;
a85e8e
-	    }
a85e8e
-          if (e1 > s2)
a85e8e
+	  if (s1 < e2 && s2 < e1)
a85e8e
             {
a85e8e
               /* This might be actually valid, but it is unbelievable that
a85e8e
                  any filesystem makes such a silly allocation.  */
a85e8e
-- 
a85e8e
2.13.0
a85e8e