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

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