* grub-core/lib/reed_solomon.c (gauss_solve): Fix size of standalone
scratch area. Make sure to initialise chosen in standalone mode as well as non-standalone. Reported by: Robert Hooker and Andy Whitcroft. Tested by: Andy Whitcroft.
This commit is contained in:
parent
d060ad60ee
commit
20641b6baa
2 changed files with 15 additions and 5 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2010-12-21 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* grub-core/lib/reed_solomon.c (gauss_solve): Fix size of standalone
|
||||||
|
scratch area. Make sure to initialise chosen in standalone mode as
|
||||||
|
well as non-standalone.
|
||||||
|
Reported by: Robert Hooker and Andy Whitcroft.
|
||||||
|
Tested by: Andy Whitcroft.
|
||||||
|
|
||||||
2010-12-21 Colin Watson <cjwatson@ubuntu.com>
|
2010-12-21 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
* grub-core/commands/echo.c (grub_cmd_echo): Make UTF-8-clean by
|
* grub-core/commands/echo.c (grub_cmd_echo): Make UTF-8-clean by
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
|
|
||||||
#ifdef TEST
|
#ifdef TEST
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#define xmalloc malloc
|
#define xmalloc malloc
|
||||||
#define grub_memset memset
|
#define grub_memset memset
|
||||||
#define grub_memcpy memcpy
|
#define grub_memcpy memcpy
|
||||||
|
@ -25,8 +27,6 @@
|
||||||
|
|
||||||
#ifndef STANDALONE
|
#ifndef STANDALONE
|
||||||
#ifdef TEST
|
#ifdef TEST
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
typedef unsigned int grub_size_t;
|
typedef unsigned int grub_size_t;
|
||||||
typedef unsigned char grub_uint8_t;
|
typedef unsigned char grub_uint8_t;
|
||||||
typedef unsigned short grub_uint16_t;
|
typedef unsigned short grub_uint16_t;
|
||||||
|
@ -45,6 +45,7 @@ typedef unsigned char grub_uint8_t;
|
||||||
typedef unsigned short grub_uint16_t;
|
typedef unsigned short grub_uint16_t;
|
||||||
#else
|
#else
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
|
#include <grub/misc.h>
|
||||||
#endif
|
#endif
|
||||||
void
|
void
|
||||||
grub_reed_solomon_recover (void *ptr_, grub_size_t s, grub_size_t rs);
|
grub_reed_solomon_recover (void *ptr_, grub_size_t s, grub_size_t rs);
|
||||||
|
@ -207,11 +208,12 @@ gauss_solve (gf_single_t *eq, int n, int m, gf_single_t *sol)
|
||||||
|
|
||||||
#ifndef STANDALONE
|
#ifndef STANDALONE
|
||||||
chosen = xmalloc (n * sizeof (int));
|
chosen = xmalloc (n * sizeof (int));
|
||||||
grub_memset (chosen, -1, n * sizeof (int));
|
|
||||||
#else
|
#else
|
||||||
chosen = (void *) scratch;
|
chosen = (void *) scratch;
|
||||||
scratch += n;
|
scratch += n * sizeof (int);
|
||||||
#endif
|
#endif
|
||||||
|
for (i = 0; i < n; i++)
|
||||||
|
chosen[i] = -1;
|
||||||
for (i = 0; i < m; i++)
|
for (i = 0; i < m; i++)
|
||||||
sol[i] = 0;
|
sol[i] = 0;
|
||||||
gauss_eliminate (eq, n, m, chosen);
|
gauss_eliminate (eq, n, m, chosen);
|
||||||
|
@ -228,7 +230,7 @@ gauss_solve (gf_single_t *eq, int n, int m, gf_single_t *sol)
|
||||||
#ifndef STANDALONE
|
#ifndef STANDALONE
|
||||||
free (chosen);
|
free (chosen);
|
||||||
#else
|
#else
|
||||||
scratch -= n;
|
scratch -= n * sizeof (int);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue