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

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