lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <adaac2e3tzp.fsf@cisco.com>
Date:	Sun, 26 Nov 2006 11:09:30 -0800
From:	Roland Dreier <rdreier@...co.com>
To:	Andrew Morton <akpm@...l.org>
Cc:	David Miller <davem@...emloft.net>, linux-kernel@...r.kernel.org,
	openib-general@...nib.org, tom@...ngridcomputing.com
Subject: Re: [PATCH] Avoid truncating to 'long' in ALIGN() macro

 > 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));
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ