[openib-general] [PATCH] Avoid truncating to 'long' in ALIGN() macro
Roland Dreier
rdreier at cisco.com
Sun Nov 26 11:09:30 PST 2006
> Changes this late in the piece rather hurt.
Fair enough. This was a really close call to me but let's leave it
for 2.6.19. I'll ask Linus to merge the patch below to fix amso1100.
I'm a little worried that other such uses might be lurking in the
tree but I guess no one has complained...
> Your proposed change is still wrong for long longs, isn't it?
Yes, it would fail for aligning long long with an unsigned long
alignment on 32-bits. But that's broken in the current tree too.
I'll post a patch that should work for everything -- how about if you
queue that for 2.6.20-early?
- R.
diff --git a/drivers/infiniband/hw/amso1100/c2_provider.c b/drivers/infiniband/hw/amso1100/c2_provider.c
index fef9727..d54b284 100644
--- a/drivers/infiniband/hw/amso1100/c2_provider.c
+++ b/drivers/infiniband/hw/amso1100/c2_provider.c
@@ -368,7 +368,7 @@ static struct ib_mr *c2_reg_phys_mr(stru
total_len += buffer_list[i].size;
pbl_depth += ALIGN(buffer_list[i].size,
- (1 << page_shift)) >> page_shift;
+ (1ull << page_shift)) >> page_shift;
}
page_list = vmalloc(sizeof(u64) * pbl_depth);
@@ -383,7 +383,7 @@ static struct ib_mr *c2_reg_phys_mr(stru
int naddrs;
naddrs = ALIGN(buffer_list[i].size,
- (1 << page_shift)) >> page_shift;
+ (1ull << page_shift)) >> page_shift;
for (k = 0; k < naddrs; k++)
page_list[j++] = (buffer_list[i].addr +
(k << page_shift));
More information about the general
mailing list