[PATCH] memory hotadd fixes: change find_next_system_ram's return value manner
0f04ab5e · KAMEZAWA Hiroyuki <[email protected]> · 2006-08-05 12:14:59 -07:00
find_next_system_ram() returns valid memory range which meets requested area,
only used by memory-hot-add.
This function always rewrite requested resource even if returned area is not
fully fit in requested one. And sometimes the returnd resource is larger than
requested area. This annoyes the caller. This patch changes the returned
value to fit in requested area.
Signed-off-by: KAMEZAWA Hiroyuki <[email protected]>
Cc: Keith Mannthey <[email protected]>
Cc: Yasunori Goto <[email protected]>
Cc: Dave Hansen <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
- Commit
- 0f04ab5efbca73ab366a156d96b073d2da35b158
- Parents
- 6f712711
Changes
1 files changed · +4 −2
diff --git a/kernel/resource.c b/kernel/resource.c
index 0dd3a85..63e8793 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -261,8 +261,10 @@ int find_next_system_ram(struct resource *res)
if (!p)
return -1;
/* copy data */
- res->start = p->start;
- res->end = p->end;
+ if (res->start < p->start)
+ res->start = p->start;
+ if (res->end > p->end)
+ res->end = p->end;
return 0;
}
#endif