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

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