[openib-general] [CMA][PATCH] port byte order fix

James Lentini jlentini at netapp.com
Wed Jan 18 08:43:01 PST 2006


The CMA appears to assume that a struct sockaddr_in's sin_port value 
will be in host byte order. This is incorrect. 

Here is a quick fix. I hope this will make it into the initial 
kernel.org submission.

Signed-off-by: James Lentini <jlentini at netapp.com>

Index: core/cma.c
===================================================================
--- core/cma.c	(revision 5063)
+++ core/cma.c	(working copy)
@@ -842,7 +842,7 @@ out:
 static __be64 cma_get_service_id(enum rdma_port_space ps, struct sockaddr *addr)
 {
 	return cpu_to_be64(((u64)ps << 16) +
-	       ((struct sockaddr_in *) addr)->sin_port);
+	       be16_to_cpu(((struct sockaddr_in *) addr)->sin_port));
 }
 
 static void cma_set_compare_data(struct sockaddr *addr,



More information about the general mailing list