Skip to contentSkip to conversation

rxe: Do not use 'struct sockaddr' in a uapi header

PATCH Applied Jason Gunthorpe 2 participants 2 messages Feb 7, 2018 – Feb 14, 2018 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rxe: Do not use 'struct sockaddr' in a uapi header

Linux has two 'linux/socket.h' files - and only the one in the kernel defines struct sockaddr - the user space one does not.

---
 drivers/infiniband/sw/rxe/rxe_av.c | 5 +++--
 include/uapi/rdma/rdma_user_rxe.h  | 4 +++-
 2 files changed, 6 insertions(+), 3 deletions(-)
drivers/infiniband/sw/rxe/rxe_av.c +3 -2
index 7522d1af3ae2a3..7f1ae364088a07 100644
@@ -74,8 +74,9 @@ void rxe_av_fill_ip_info(struct rxe_av *av,
 			struct ib_gid_attr *sgid_attr,
 			union ib_gid *sgid)
 {
-	rdma_gid2ip(&av->sgid_addr._sockaddr, sgid);
-	rdma_gid2ip(&av->dgid_addr._sockaddr, &rdma_ah_read_grh(attr)->dgid);
+	rdma_gid2ip((struct sockaddr *)&av->sgid_addr, sgid);
+	rdma_gid2ip((struct sockaddr *)&av->dgid_addr,
+		    &rdma_ah_read_grh(attr)->dgid);
 	av->network_type = ib_gid_to_network_type(sgid_attr->gid_type, sgid);
 }
 
include/uapi/rdma/rdma_user_rxe.h +3 -1
index bdeea948b2f3a4..e3e6852b58eb45 100644
@@ -35,6 +35,9 @@
 #define RDMA_USER_RXE_H
 
 #include <linux/types.h>
+#include <linux/socket.h>
+#include <linux/in.h>
+#include <linux/in6.h>
 
 union rxe_gid {
 	__u8	raw[16];
@@ -57,7 +60,6 @@ struct rxe_av {
 	__u8			network_type;
 	struct rxe_global_route	grh;
 	union {
-		struct sockaddr		_sockaddr;
 		struct sockaddr_in	_sockaddr_in;
 		struct sockaddr_in6	_sockaddr_in6;
 	} sgid_addr, dgid_addr;
Signature · 6 lines
2.16.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20180207234910.GA14608-uk2M96/[email protected]

#2 lore raw
Quoted 7 lines · Jason Gunthorpe

Linux has two 'linux/socket.h' files - and only the one in the kernel defines struct sockaddr - the user space one does not.

 drivers/infiniband/sw/rxe/rxe_av.c | 5 +++--
 include/uapi/rdma/rdma_user_rxe.h  | 4 +++-
 2 files changed, 6 insertions(+), 3 deletions(-)

applied to -next

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html