Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4978db... Commit: 4978db5bd964d90265f957f980ab2b0771ca2b9f Parent: 94d149c34cda933ff5096aca94bb23bf68602f4e Author: David S. Miller <davem@davemloft.net> AuthorDate: Mon May 12 16:51:15 2008 -0700 Committer: David S. Miller <davem@davemloft.net> CommitDate: Mon May 12 16:51:15 2008 -0700 lmb: Fix inconsistent alignment of size argument. When allocating, if we will align up the size when making the reservation, we should also align the size for the check that the space is actually available. The simplest thing is to just aling the size up from the beginning, then we can use plain 'size' throughout. Signed-off-by: David S. Miller <davem@davemloft.net> --- lib/lmb.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/lmb.c b/lib/lmb.c index 83287d3..93445dc 100644 --- a/lib/lmb.c +++ b/lib/lmb.c @@ -286,8 +286,7 @@ static u64 __init lmb_alloc_nid_unreserved(u64 start, u64 end, j = lmb_overlaps_region(&lmb.reserved, base, size); if (j < 0) { /* this area isn't reserved, take it */ - if (lmb_add_region(&lmb.reserved, base, - lmb_align_up(size, align)) < 0) + if (lmb_add_region(&lmb.reserved, base, size) < 0) base = ~(u64)0; return base; } @@ -333,6 +332,10 @@ u64 __init lmb_alloc_nid(u64 size, u64 align, int nid, struct lmb_region *mem = &lmb.memory; int i; + BUG_ON(0 == size); + + size = lmb_align_up(size, align); + for (i = 0; i < mem->cnt; i++) { u64 ret = lmb_alloc_nid_region(&mem->region[i], nid_range, @@ -370,6 +373,8 @@ u64 __init __lmb_alloc_base(u64 size, u64 align, u64 max_addr) BUG_ON(0 == size); + size = lmb_align_up(size, align); + /* On some platforms, make sure we allocate lowmem */ /* Note that LMB_REAL_LIMIT may be LMB_ALLOC_ANYWHERE */ if (max_addr == LMB_ALLOC_ANYWHERE) @@ -393,8 +398,7 @@ u64 __init __lmb_alloc_base(u64 size, u64 align, u64 max_addr) j = lmb_overlaps_region(&lmb.reserved, base, size); if (j < 0) { /* this area isn't reserved, take it */ - if (lmb_add_region(&lmb.reserved, base, - lmb_align_up(size, align)) < 0) + if (lmb_add_region(&lmb.reserved, base, size) < 0) return 0; return base; } -- To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
| Vladislav Bolkhovitin | Re: Integration of SCST in the mainstream Linux kernel |
| Peter Zijlstra | [PATCH 6/6] sched: disabled rt-bandwidth by default |
| Tejun Heo | [PATCHSET] CUSE: implement CUSE |
| Richard Jonsson | forcedeth: MAC-address reversed on resume from suspend |
git: | |
| Junio C Hamano | [0/4] What's not in 1.5.2 (overview) |
| Jan Hudec | Smart fetch via HTTP? |
| Johannes Schindelin | Re: git log filtering |
| Junio C Hamano | [PATCH] combine-diff: reuse diff from the same blob. |
| Julien TOUCHE | setting up ssh tunnel/vpn |
| Jordi Prats | OpenBSD with pf on a mini-ITX? |
| GVG GVG | ssh_exchange_identification: Connection closed by remote host |
| Reyk Floeter | Re: hoststated(8): DNS Relay uses unexpected source IP address |
| David Miller | Re: [ANNOUNCE] Btrfs v0.12 released |
| Christophe Saout | Re: silent semantic changes with reiser4 |
| Anton Altaparmakov | Re: [RFC] add FIEMAP ioctl to efficiently map file allocation |
| Rik van Riel | Re: [RFD] Incremental fsck |
