* Backport from upstream:

- Fix hook calling for unaligned segments (closes: #666992,
    LP: #972250).
This commit is contained in:
Colin Watson 2012-04-03 14:16:52 +01:00
parent 92f49cf66b
commit b090f41ab9
2 changed files with 21 additions and 11 deletions

8
debian/changelog vendored
View File

@ -1,3 +1,11 @@
grub2 (1.99-21) UNRELEASED; urgency=low
* Backport from upstream:
- Fix hook calling for unaligned segments (closes: #666992,
LP: #972250).
-- Colin Watson <cjwatson@debian.org> Tue, 03 Apr 2012 14:14:42 +0100
grub2 (1.99-20) unstable; urgency=low grub2 (1.99-20) unstable; urgency=low
* Backport kFreeBSD support from upstream to 4k_sectors.patch. * Backport kFreeBSD support from upstream to 4k_sectors.patch.

View File

@ -1,6 +1,7 @@
Description: Support non-512B sectors and agglomerate reads Description: Support non-512B sectors and agglomerate reads
Author: Vladimir Serbinenko <phcoder@gmail.com> Author: Vladimir Serbinenko <phcoder@gmail.com>
Origin: backport, http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3325 Origin: backport, http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3325
Origin: upstream, http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3709
Forwarded: not-needed Forwarded: not-needed
Applied-Upstream: http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3325 Applied-Upstream: http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3325
Last-Update: 2012-04-02 Last-Update: 2012-04-02
@ -491,7 +492,7 @@ Index: b/grub-core/kern/disk.c
/* First of all, check if the region is within the disk. */ /* First of all, check if the region is within the disk. */
if (grub_disk_adjust_range (disk, &sector, &offset, size) != GRUB_ERR_NONE) if (grub_disk_adjust_range (disk, &sector, &offset, size) != GRUB_ERR_NONE)
@@ -399,126 +496,125 @@ @@ -399,126 +496,126 @@
return grub_errno; return grub_errno;
} }
@ -700,19 +701,20 @@ Index: b/grub-core/kern/disk.c
- grub_free (tmp_buf); - grub_free (tmp_buf);
+ while (l) + while (l)
+ { + {
+ (disk->read_hook) (s, o, + grub_size_t cl;
+ ((l > GRUB_DISK_SECTOR_SIZE) + cl = GRUB_DISK_SECTOR_SIZE - o;
+ ? GRUB_DISK_SECTOR_SIZE + if (cl > l)
+ : l)); + cl = l;
+ (disk->read_hook) (s, o, cl);
+ s++; + s++;
+ l -= GRUB_DISK_SECTOR_SIZE - o; + l -= cl;
+ o = 0; + o = 0;
+ } + }
+ } + }
return grub_errno; return grub_errno;
} }
@@ -528,25 +624,31 @@ @@ -528,25 +625,31 @@
grub_off_t offset, grub_size_t size, const void *buf) grub_off_t offset, grub_size_t size, const void *buf)
{ {
unsigned real_offset; unsigned real_offset;
@ -748,7 +750,7 @@ Index: b/grub-core/kern/disk.c
!= GRUB_ERR_NONE) != GRUB_ERR_NONE)
{ {
disk->partition = part; disk->partition = part;
@@ -554,7 +656,7 @@ @@ -554,7 +657,7 @@
} }
disk->partition = part; disk->partition = part;
@ -757,7 +759,7 @@ Index: b/grub-core/kern/disk.c
if (len > size) if (len > size)
len = size; len = size;
@@ -565,7 +667,7 @@ @@ -565,7 +668,7 @@
if ((disk->dev->write) (disk, sector, 1, tmp_buf) != GRUB_ERR_NONE) if ((disk->dev->write) (disk, sector, 1, tmp_buf) != GRUB_ERR_NONE)
goto finish; goto finish;
@ -766,7 +768,7 @@ Index: b/grub-core/kern/disk.c
buf = (char *) buf + len; buf = (char *) buf + len;
size -= len; size -= len;
real_offset = 0; real_offset = 0;
@@ -575,8 +677,8 @@ @@ -575,8 +678,8 @@
grub_size_t len; grub_size_t len;
grub_size_t n; grub_size_t n;
@ -777,7 +779,7 @@ Index: b/grub-core/kern/disk.c
if ((disk->dev->write) (disk, sector, n, buf) != GRUB_ERR_NONE) if ((disk->dev->write) (disk, sector, n, buf) != GRUB_ERR_NONE)
goto finish; goto finish;
@@ -599,6 +701,8 @@ @@ -599,6 +702,8 @@
{ {
if (disk->partition) if (disk->partition)
return grub_partition_get_len (disk->partition); return grub_partition_get_len (disk->partition);