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

28f7f8
From 0000000000000000000000000000000000000000 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
28f7f8
Subject: [PATCH] * grub-core/commands/loadenv.c (check_blocklists): Fix
28f7f8
 overlap check.
39700a
39700a
---
39700a
 grub-core/commands/loadenv.c | 13 ++-----------
28f7f8
 ChangeLog                    |  4 ++++
39700a
 2 files changed, 6 insertions(+), 11 deletions(-)
39700a
39700a
diff --git a/grub-core/commands/loadenv.c b/grub-core/commands/loadenv.c
28f7f8
index 6af81120745..acd93d123ed 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.  */
28f7f8
diff --git a/ChangeLog b/ChangeLog
28f7f8
index 4ce664327f9..a2da9743231 100644
28f7f8
--- a/ChangeLog
28f7f8
+++ b/ChangeLog
28f7f8
@@ -1,3 +1,7 @@
28f7f8
+2014-06-21  Роман Пехов <roman_pekhov>
28f7f8
+
28f7f8
+	* grub-core/commands/loadenv.c (check_blocklists): Fix overlap check.
28f7f8
+
28f7f8
 2014-06-21  Glenn Washburn <development@efficientek.com>
28f7f8
 
28f7f8
 	* util/grub-install.c: Fix handling of --disk-module.