Avoid using Reed-Solomon with 0 redundancy.
* grub-core/kern/i386/pc/startup.S: Remove 0-data check. * grub-core/lib/reed_solomon.c (decode_block): Do not proceed on 0 data or 0 redundancy. (grub_reed_solomon_add_redundancy): Do not proceed with 0 redundancy. (grub_reed_solomon_recover): Likewise.
This commit is contained in:
parent
25dd47804d
commit
c76386454e
3 changed files with 24 additions and 4 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2010-12-27 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Avoid using Reed-Solomon with 0 redundancy.
|
||||
|
||||
* grub-core/kern/i386/pc/startup.S: Remove 0-data check.
|
||||
* grub-core/lib/reed_solomon.c (decode_block): Do not proceed on 0 data
|
||||
or 0 redundancy.
|
||||
(grub_reed_solomon_add_redundancy): Do not proceed with 0 redundancy.
|
||||
(grub_reed_solomon_recover): Likewise.
|
||||
|
||||
2010-12-27 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Don't use disk subsystem in freebsd_boot.
|
||||
|
|
|
@ -151,8 +151,6 @@ LOCAL (codestart):
|
|||
addl $(GRUB_KERNEL_MACHINE_RAW_SIZE - GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART), %edx
|
||||
movl reed_solomon_redundancy, %ecx
|
||||
leal _start + GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART, %eax
|
||||
testl %edx, %edx
|
||||
jz post_reed_solomon
|
||||
call EXT_C (grub_reed_solomon_recover)
|
||||
jmp post_reed_solomon
|
||||
|
||||
|
|
|
@ -372,6 +372,10 @@ decode_block (gf_single_t *ptr, grub_size_t s,
|
|||
grub_size_t rr = (rs + SECTOR_SIZE - 1 - i) / SECTOR_SIZE;
|
||||
gf_single_t m[ds + rr];
|
||||
|
||||
/* Nothing to do. */
|
||||
if (!ds || !rr)
|
||||
continue;
|
||||
|
||||
for (j = 0; j < (int) ds; j++)
|
||||
m[j] = ptr[SECTOR_SIZE * j + i];
|
||||
for (j = 0; j < (int) rr; j++)
|
||||
|
@ -414,6 +418,10 @@ grub_reed_solomon_add_redundancy (void *buffer, grub_size_t data_size,
|
|||
gf_single_t *ptr = buffer;
|
||||
gf_single_t *rptr = ptr + s;
|
||||
|
||||
/* Nothing to do. */
|
||||
if (!rs)
|
||||
return;
|
||||
|
||||
while (s > 0)
|
||||
{
|
||||
grub_size_t tt;
|
||||
|
@ -441,6 +449,10 @@ grub_reed_solomon_recover (void *ptr_, grub_size_t s, grub_size_t rs)
|
|||
gf_single_t *ptr = ptr_;
|
||||
gf_single_t *rptr = ptr + s;
|
||||
|
||||
/* Nothing to do. */
|
||||
if (!rs)
|
||||
return;
|
||||
|
||||
#if defined (STANDALONE)
|
||||
init_inverts ();
|
||||
#endif
|
||||
|
@ -454,8 +466,8 @@ grub_reed_solomon_recover (void *ptr_, grub_size_t s, grub_size_t rs)
|
|||
tt = cs + crs;
|
||||
if (tt > MAX_BLOCK_SIZE)
|
||||
{
|
||||
cs = cs * MAX_BLOCK_SIZE / tt;
|
||||
crs = crs * MAX_BLOCK_SIZE / tt;
|
||||
cs = (cs * MAX_BLOCK_SIZE) / tt;
|
||||
crs = (crs * MAX_BLOCK_SIZE) / tt;
|
||||
}
|
||||
decode_block (ptr, cs, rptr, crs);
|
||||
ptr += cs;
|
||||
|
|
Loading…
Reference in a new issue