Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 99687
b: refs/heads/master
c: c3965bd
h: refs/heads/master
i:
  99685: 96f77c3
  99683: 8f12cc9
  99679: d38995f
v: v3
  • Loading branch information
Paul Jackson authored and Thomas Gleixner committed May 25, 2008
1 parent ca8997a commit a37114f
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b25e31cec7788ccba5749d10f8f4343fffff4750
refs/heads/master: c3965bd15118742d72b4bc1a290d37b3f081eb98
3 changes: 2 additions & 1 deletion trunk/arch/x86/boot/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/

#include "boot.h"
#include <linux/kernel.h>

#define SMAP 0x534d4150 /* ASCII "SMAP" */

Expand Down Expand Up @@ -53,7 +54,7 @@ static int detect_memory_e820(void)

count++;
desc++;
} while (next && count < E820MAX);
} while (next && count < ARRAY_SIZE(boot_params.e820_map));

return boot_params.e820_entries = count;
}
Expand Down
9 changes: 5 additions & 4 deletions trunk/arch/x86/kernel/e820.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void __init add_memory_region(u64 start, u64 size, int type)
{
int x = e820.nr_map;

if (x == E820MAX) {
if (x == ARRAY_SIZE(e820.map)) {
printk(KERN_ERR "Ooops! Too many entries in the memory map!\n");
return;
}
Expand Down Expand Up @@ -142,7 +142,8 @@ void __init e820_print_map(char *who)
* replaces the original e820 map with a new one, removing overlaps.
*
*/
int __init sanitize_e820_map(struct e820entry *biosmap, char *pnr_map)
int __init sanitize_e820_map(struct e820entry *biosmap, int max_nr_map,
char *pnr_map)
{
struct change_member {
struct e820entry *pbios; /* pointer to original bios entry */
Expand Down Expand Up @@ -314,7 +315,7 @@ int __init sanitize_e820_map(struct e820entry *biosmap, char *pnr_map)
* no more space left for new
* bios entries ?
*/
if (++new_bios_entry >= E820MAX)
if (++new_bios_entry >= max_nr_map)
break;
}
if (current_type != 0) {
Expand Down Expand Up @@ -403,7 +404,7 @@ void __init update_e820(void)
u8 nr_map;

nr_map = e820.nr_map;
if (sanitize_e820_map(e820.map, &nr_map))
if (sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &nr_map))
return;
e820.nr_map = nr_map;
printk(KERN_INFO "modified physical RAM map:\n");
Expand Down
6 changes: 4 additions & 2 deletions trunk/arch/x86/kernel/e820_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,9 @@ char *__init machine_specific_memory_setup(void)
* Otherwise fake a memory map; one section from 0k->640k,
* the next section from 1mb->appropriate_mem_k
*/
sanitize_e820_map(boot_params.e820_map, &boot_params.e820_entries);
sanitize_e820_map(boot_params.e820_map,
ARRAY_SIZE(boot_params.e820_map),
&boot_params.e820_entries);
if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries) < 0)
early_panic("Cannot find a valid memory map");
printk(KERN_INFO "BIOS-provided physical RAM map:\n");
Expand Down Expand Up @@ -484,7 +486,7 @@ void __init finish_e820_parsing(void)
if (userdef) {
char nr = e820.nr_map;

if (sanitize_e820_map(e820.map, &nr) < 0)
if (sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &nr) < 0)
early_panic("Invalid user supplied memory map");
e820.nr_map = nr;

Expand Down
4 changes: 3 additions & 1 deletion trunk/arch/x86/mach-default/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ char * __init machine_specific_memory_setup(void)
* Otherwise fake a memory map; one section from 0k->640k,
* the next section from 1mb->appropriate_mem_k
*/
sanitize_e820_map(boot_params.e820_map, &boot_params.e820_entries);
sanitize_e820_map(boot_params.e820_map,
ARRAY_SIZE(boot_params.e820_map),
&boot_params.e820_entries);
if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries)
< 0) {
unsigned long mem_size;
Expand Down
4 changes: 3 additions & 1 deletion trunk/arch/x86/mach-voyager/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ char *__init machine_specific_memory_setup(void)
* Otherwise fake a memory map; one section from 0k->640k,
* the next section from 1mb->appropriate_mem_k
*/
sanitize_e820_map(boot_params.e820_map, &boot_params.e820_entries);
sanitize_e820_map(boot_params.e820_map,
ARRAY_SIZE(boot_params.e820_map),
&boot_params.e820_entries);
if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries)
< 0) {
unsigned long mem_size;
Expand Down
3 changes: 2 additions & 1 deletion trunk/include/asm-x86/e820.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ extern int e820_any_mapped(u64 start, u64 end, unsigned type);
extern int e820_all_mapped(u64 start, u64 end, unsigned type);
extern void add_memory_region(u64 start, u64 size, int type);
extern void e820_print_map(char *who);
extern int sanitize_e820_map(struct e820entry *biosmap, char *pnr_map);
extern int
sanitize_e820_map(struct e820entry *biosmap, int max_nr_map, char *pnr_map);
extern int copy_e820_map(struct e820entry *biosmap, int nr_map);
extern u64 update_memory_range(u64 start, u64 size, unsigned old_type,
unsigned new_type);
Expand Down
1 change: 0 additions & 1 deletion trunk/include/asm-x86/setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ char * __init machine_specific_memory_setup(void);
char *memory_setup(void);

int __init copy_e820_map(struct e820entry *biosmap, int nr_map);
int __init sanitize_e820_map(struct e820entry *biosmap, char *pnr_map);
void __init add_memory_region(unsigned long long start,
unsigned long long size, int type);

Expand Down

0 comments on commit a37114f

Please sign in to comment.