Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 9395
b: refs/heads/master
c: 0f7347c
h: refs/heads/master
i:
  9393: 5029ea6
  9391: 278fdbe
v: v3
  • Loading branch information
Rafael J. Wysocki authored and Linus Torvalds committed Sep 28, 2005
1 parent 8f512a7 commit f45fb61
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 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: f65a4d10c8a4eb9f919cf416e5dcd720b7d20f50
refs/heads/master: 0f7347c20c410c300be0db4c132945fd02e54110
5 changes: 4 additions & 1 deletion trunk/kernel/power/power.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
#define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1)
#endif

#define MAX_PBES ((PAGE_SIZE - sizeof(struct new_utsname) \
- 4 - 3*sizeof(unsigned long) - sizeof(int) \
- sizeof(void *)) / sizeof(swp_entry_t))

struct swsusp_info {
struct new_utsname uts;
Expand All @@ -18,7 +21,7 @@ struct swsusp_info {
unsigned long image_pages;
unsigned long pagedir_pages;
suspend_pagedir_t * suspend_pagedir;
swp_entry_t pagedir[768];
swp_entry_t pagedir[MAX_PBES];
} __attribute__((aligned(PAGE_SIZE)));


Expand Down
4 changes: 4 additions & 0 deletions trunk/kernel/power/swsusp.c
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,10 @@ static int swsusp_alloc(void)
if (!enough_swap())
return -ENOSPC;

if (MAX_PBES < nr_copy_pages / PBES_PER_PAGE +
!!(nr_copy_pages % PBES_PER_PAGE))
return -ENOSPC;

if (!(pagedir_save = alloc_pagedir(nr_copy_pages))) {
printk(KERN_ERR "suspend: Allocating pagedir failed.\n");
return -ENOMEM;
Expand Down

0 comments on commit f45fb61

Please sign in to comment.