From: Roland Dreier <rdreier@cisco.com>
To: Andrew Morton <akpm@osdl.org>
Cc: David Miller <davem@davemloft.net>,
linux-kernel@vger.kernel.org, openib-general@openib.org,
tom@opengridcomputing.com
Subject: Re: [PATCH] Avoid truncating to 'long' in ALIGN() macro
Date: Sun, 26 Nov 2006 11:09:30 -0800 [thread overview]
Message-ID: <adaac2e3tzp.fsf@cisco.com> (raw)
In-Reply-To: <20061125164118.de53d1cf.akpm@osdl.org> (Andrew Morton's message of "Sat, 25 Nov 2006 16:41:18 -0800")
> 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));
next prev parent reply other threads:[~2006-11-26 19:09 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-25 5:40 [PATCH] Avoid truncating to 'long' in ALIGN() macro Roland Dreier
2006-11-25 6:07 ` David Miller
2006-11-25 22:56 ` Roland Dreier
2006-11-25 23:05 ` David Miller
2006-11-25 23:09 ` Roland Dreier
2006-11-26 0:41 ` Andrew Morton
2006-11-26 19:09 ` Roland Dreier [this message]
2006-11-26 19:10 ` Roland Dreier
2006-11-26 19:17 ` Andrew Morton
2006-11-26 20:06 ` Roland Dreier
2006-11-26 20:11 ` Linus Torvalds
2006-11-26 20:26 ` Roland Dreier
2006-11-26 21:06 ` Jörn Engel
2006-11-26 22:20 ` Linus Torvalds
2006-11-27 4:41 ` Al Viro
2006-11-26 1:10 ` Al Viro
2006-11-26 1:17 ` Roland Dreier
2006-11-26 1:25 ` Al Viro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=adaac2e3tzp.fsf@cisco.com \
--to=rdreier@cisco.com \
--cc=akpm@osdl.org \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=openib-general@openib.org \
--cc=tom@opengridcomputing.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox