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: <1450741676-5865-13-git-send-email-viro@ZenIV.linux.org.uk>
Date:	Mon, 21 Dec 2015 23:46:46 +0000
From:	Al Viro <viro@...IV.linux.org.uk>
To:	linux-kernel@...r.kernel.org
Cc:	Linus Torvalds <torvalds@...ux-foundation.org>
Subject: [POC][PATCH 13/83] rds: keep pointers in ->m_page_addrs[]

From: Al Viro <viro@...iv.linux.org.uk>

Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
---
 net/rds/cong.c     | 16 ++++++++--------
 net/rds/ib_recv.c  |  2 +-
 net/rds/iw_recv.c  |  2 +-
 net/rds/message.c  |  2 +-
 net/rds/rds.h      |  4 ++--
 net/rds/tcp_recv.c |  2 +-
 6 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/net/rds/cong.c b/net/rds/cong.c
index 6f91538..a56b076 100644
--- a/net/rds/cong.c
+++ b/net/rds/cong.c
@@ -136,7 +136,7 @@ static struct rds_cong_map *rds_cong_from_addr(__be32 addr)
 {
 	struct rds_cong_map *map;
 	struct rds_cong_map *ret = NULL;
-	unsigned long zp;
+	void *zp;
 	unsigned long i;
 	unsigned long flags;
 
@@ -149,8 +149,8 @@ static struct rds_cong_map *rds_cong_from_addr(__be32 addr)
 	INIT_LIST_HEAD(&map->m_conn_list);
 
 	for (i = 0; i < RDS_CONG_MAP_PAGES; i++) {
-		zp = (unsigned long)get_zeroed_page(GFP_KERNEL);
-		if (zp == 0)
+		zp = get_zeroed_page(GFP_KERNEL);
+		if (!zp)
 			goto out;
 		map->m_page_addrs[i] = zp;
 	}
@@ -167,7 +167,7 @@ static struct rds_cong_map *rds_cong_from_addr(__be32 addr)
 out:
 	if (map) {
 		for (i = 0; i < RDS_CONG_MAP_PAGES && map->m_page_addrs[i]; i++)
-			free_page((void *)map->m_page_addrs[i]);
+			free_page(map->m_page_addrs[i]);
 		kfree(map);
 	}
 
@@ -299,7 +299,7 @@ void rds_cong_set_bit(struct rds_cong_map *map, __be16 port)
 	i = be16_to_cpu(port) / RDS_CONG_MAP_PAGE_BITS;
 	off = be16_to_cpu(port) % RDS_CONG_MAP_PAGE_BITS;
 
-	__set_bit_le(off, (void *)map->m_page_addrs[i]);
+	__set_bit_le(off, map->m_page_addrs[i]);
 }
 
 void rds_cong_clear_bit(struct rds_cong_map *map, __be16 port)
@@ -313,7 +313,7 @@ void rds_cong_clear_bit(struct rds_cong_map *map, __be16 port)
 	i = be16_to_cpu(port) / RDS_CONG_MAP_PAGE_BITS;
 	off = be16_to_cpu(port) % RDS_CONG_MAP_PAGE_BITS;
 
-	__clear_bit_le(off, (void *)map->m_page_addrs[i]);
+	__clear_bit_le(off, map->m_page_addrs[i]);
 }
 
 static int rds_cong_test_bit(struct rds_cong_map *map, __be16 port)
@@ -324,7 +324,7 @@ static int rds_cong_test_bit(struct rds_cong_map *map, __be16 port)
 	i = be16_to_cpu(port) / RDS_CONG_MAP_PAGE_BITS;
 	off = be16_to_cpu(port) % RDS_CONG_MAP_PAGE_BITS;
 
-	return test_bit_le(off, (void *)map->m_page_addrs[i]);
+	return test_bit_le(off, map->m_page_addrs[i]);
 }
 
 void rds_cong_add_socket(struct rds_sock *rs)
@@ -399,7 +399,7 @@ void rds_cong_exit(void)
 		rdsdebug("freeing map %p\n", map);
 		rb_erase(&map->m_rb_node, &rds_cong_tree);
 		for (i = 0; i < RDS_CONG_MAP_PAGES && map->m_page_addrs[i]; i++)
-			free_page((void *)map->m_page_addrs[i]);
+			free_page(map->m_page_addrs[i]);
 		kfree(map);
 	}
 }
diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c
index 977fb86..74cb081 100644
--- a/net/rds/ib_recv.c
+++ b/net/rds/ib_recv.c
@@ -797,7 +797,7 @@ static void rds_ib_cong_recv(struct rds_connection *conn,
 		addr = kmap_atomic(sg_page(&frag->f_sg));
 
 		src = addr + frag_off;
-		dst = (void *)map->m_page_addrs[map_page] + map_off;
+		dst = map->m_page_addrs[map_page] + map_off;
 		for (k = 0; k < to_copy; k += 8) {
 			/* Record ports that became uncongested, ie
 			 * bits that changed from 0 to 1. */
diff --git a/net/rds/iw_recv.c b/net/rds/iw_recv.c
index a66d179..c83e6e2 100644
--- a/net/rds/iw_recv.c
+++ b/net/rds/iw_recv.c
@@ -586,7 +586,7 @@ static void rds_iw_cong_recv(struct rds_connection *conn,
 		addr = kmap_atomic(frag->f_page);
 
 		src = addr + frag_off;
-		dst = (void *)map->m_page_addrs[map_page] + map_off;
+		dst = map->m_page_addrs[map_page] + map_off;
 		for (k = 0; k < to_copy; k += 8) {
 			/* Record ports that became uncongested, ie
 			 * bits that changed from 0 to 1. */
diff --git a/net/rds/message.c b/net/rds/message.c
index 756c737..6adea64 100644
--- a/net/rds/message.c
+++ b/net/rds/message.c
@@ -235,7 +235,7 @@ struct scatterlist *rds_message_alloc_sgs(struct rds_message *rm, int nents)
 	return sg_ret;
 }
 
-struct rds_message *rds_message_map_pages(unsigned long *page_addrs, unsigned int total_len)
+struct rds_message *rds_message_map_pages(void **page_addrs, unsigned int total_len)
 {
 	struct rds_message *rm;
 	unsigned int i;
diff --git a/net/rds/rds.h b/net/rds/rds.h
index 0e2797b..d315431 100644
--- a/net/rds/rds.h
+++ b/net/rds/rds.h
@@ -59,7 +59,7 @@ struct rds_cong_map {
 	__be32			m_addr;
 	wait_queue_head_t	m_waitq;
 	struct list_head	m_conn_list;
-	unsigned long		m_page_addrs[RDS_CONG_MAP_PAGES];
+	void *			m_page_addrs[RDS_CONG_MAP_PAGES];
 };
 
 
@@ -676,7 +676,7 @@ rds_conn_connecting(struct rds_connection *conn)
 struct rds_message *rds_message_alloc(unsigned int nents, gfp_t gfp);
 struct scatterlist *rds_message_alloc_sgs(struct rds_message *rm, int nents);
 int rds_message_copy_from_user(struct rds_message *rm, struct iov_iter *from);
-struct rds_message *rds_message_map_pages(unsigned long *page_addrs, unsigned int total_len);
+struct rds_message *rds_message_map_pages(void **page_addrs, unsigned int total_len);
 void rds_message_populate_header(struct rds_header *hdr, __be16 sport,
 				 __be16 dport, u64 seq);
 int rds_message_add_extension(struct rds_header *hdr,
diff --git a/net/rds/tcp_recv.c b/net/rds/tcp_recv.c
index 27a9921..af75e1b 100644
--- a/net/rds/tcp_recv.c
+++ b/net/rds/tcp_recv.c
@@ -130,7 +130,7 @@ static void rds_tcp_cong_recv(struct rds_connection *conn,
 
 			/* only returns 0 or -error */
 			ret = skb_copy_bits(skb, skb_off,
-				(void *)map->m_page_addrs[map_page] + map_off,
+				map->m_page_addrs[map_page] + map_off,
 				to_copy);
 			BUG_ON(ret != 0);
 
-- 
2.1.4

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