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>] [day] [month] [year] [list]
Date:	Mon Nov 17 23:47:44 CST 2008
From:	Rusty Russell <rusty@...tcorp.com.au>
To:	linux-kernel@...r.kernel.org
Cc:	netdev@...r.kernel.org
Subject: [PATCH 2/3] Clean up alloc_percpu: add align argument to __alloc_percpu.


This prepares for a real __alloc_percpu, by adding an alignment argument.
Currently there are two files which use this, so fix them up too.

Signed-off-by: Rusty Russell <rusty@...tcorp.com.au> 
Cc: Christoph Lameter <cl@...ux-foundation.org>
Cc: Jens Axboe <axboe@...nel.dk>
Cc: netdev@...r.kernel.org
---
 block/blktrace.c       |    2 +-
 include/linux/percpu.h |    5 +++--
 net/ipv4/af_inet.c     |    4 ++--
 3 files changed, 6 insertions(+), 5 deletions(-)

diff -r d7e495785ad1 block/blktrace.c
--- a/block/blktrace.c	Mon Nov 17 20:23:37 2008 +1030
+++ b/block/blktrace.c	Mon Nov 17 20:56:22 2008 +1030
@@ -389,7 +389,7 @@
 	if (!bt->sequence)
 		goto err;
 
-	bt->msg_data = __alloc_percpu(BLK_TN_MAX_MSG);
+	bt->msg_data = __alloc_percpu(BLK_TN_MAX_MSG, __alignof__(char));
 	if (!bt->msg_data)
 		goto err;
 
diff -r d7e495785ad1 include/linux/percpu.h
--- a/include/linux/percpu.h	Mon Nov 17 20:23:37 2008 +1030
+++ b/include/linux/percpu.h	Mon Nov 17 20:56:22 2008 +1030
@@ -112,9 +112,10 @@
 
 /* (legacy) interface for use without CPU hotplug handling */
 
-#define __alloc_percpu(size)	percpu_alloc_mask((size), GFP_KERNEL, \
+#define __alloc_percpu(size, align)	percpu_alloc_mask((size), GFP_KERNEL, \
 						  cpu_possible_map)
-#define alloc_percpu(type)	(type *)__alloc_percpu(sizeof(type))
+#define alloc_percpu(type)	(type *)__alloc_percpu(sizeof(type), \
+						       __alignof__(type))
 #define free_percpu(ptr)	percpu_free((ptr))
 #define per_cpu_ptr(ptr, cpu)	percpu_ptr((ptr), (cpu))
 
diff -r d7e495785ad1 net/ipv4/af_inet.c
--- a/net/ipv4/af_inet.c	Mon Nov 17 20:23:37 2008 +1030
+++ b/net/ipv4/af_inet.c	Mon Nov 17 20:56:22 2008 +1030
@@ -1283,10 +1283,10 @@
 int snmp_mib_init(void *ptr[2], size_t mibsize)
 {
 	BUG_ON(ptr == NULL);
-	ptr[0] = __alloc_percpu(mibsize);
+	ptr[0] = __alloc_percpu(mibsize, __alignof__(unsigned long));
 	if (!ptr[0])
 		goto err0;
-	ptr[1] = __alloc_percpu(mibsize);
+	ptr[1] = __alloc_percpu(mibsize, __alignof__(unsigned long));
 	if (!ptr[1])
 		goto err1;
 	return 0;

--
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