public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH rdma-core 0/7] Bugs found by sparse
@ 2017-03-14 16:21 Jason Gunthorpe
       [not found] ` <1489508474-16664-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Jason Gunthorpe @ 2017-03-14 16:21 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA

Since Bart got sparse working I took a quick look at what is in the core
libaries, these cases look like bugs to me.

I have another series that adds lots of sparse annotations to send later..

https://github.com/linux-rdma/rdma-core/pull/97

Jason Gunthorpe (7):
  Drop debugging print in CMakeLists.txt
  Fix missing swaps when computing path bits
  Fix various missing swaps in debugging/logging macros
  Add missing statics
  acm: Fix incorrect TID masking
  cmpost: Add missing swap for sin_port
  acm: Fix missing swap in pkey compare

 CMakeLists.txt                      |  1 -
 ibacm/prov/acmp/src/acmp.c          | 19 ++++++++++---------
 ibacm/src/acm.c                     |  8 ++++----
 libibcm/examples/cmpost.c           |  2 +-
 libibverbs/examples/xsrq_pingpong.c |  2 +-
 librdmacm/rsocket.c                 |  2 +-
 providers/qedr/qelr_verbs.c         |  4 ++--
 7 files changed, 19 insertions(+), 19 deletions(-)

-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH rdma-core 1/7] Drop debugging print in CMakeLists.txt
       [not found] ` <1489508474-16664-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2017-03-14 16:21   ` Jason Gunthorpe
  2017-03-14 16:21   ` [PATCH rdma-core 2/7] Fix missing swaps when computing path bits Jason Gunthorpe
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Jason Gunthorpe @ 2017-03-14 16:21 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 CMakeLists.txt | 1 -
 1 file changed, 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7ebf8edfee7686..358bfd543e7785 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -135,7 +135,6 @@ RDMA_BuildType()
 include_directories(${BUILD_INCLUDE})
 
 RDMA_CheckSparse()
-message(STATUS "SPARSE1 ${HAVE_SPARSE}")
 
 # Require GNU99 mode
 RDMA_EnableCStd()
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH rdma-core 2/7] Fix missing swaps when computing path bits
       [not found] ` <1489508474-16664-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  2017-03-14 16:21   ` [PATCH rdma-core 1/7] Drop debugging print in CMakeLists.txt Jason Gunthorpe
@ 2017-03-14 16:21   ` Jason Gunthorpe
       [not found]     ` <1489508474-16664-3-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  2017-03-14 16:21   ` [PATCH rdma-core 3/7] Fix various missing swaps in debugging/logging macros Jason Gunthorpe
                     ` (5 subsequent siblings)
  7 siblings, 1 reply; 13+ messages in thread
From: Jason Gunthorpe @ 2017-03-14 16:21 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Sean Hefty

Sparse says the slid is BE in this context.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 ibacm/prov/acmp/src/acmp.c | 4 ++--
 librdmacm/rsocket.c        | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/ibacm/prov/acmp/src/acmp.c b/ibacm/prov/acmp/src/acmp.c
index d7c797fccd7728..da4e69cd171f5b 100644
--- a/ibacm/prov/acmp/src/acmp.c
+++ b/ibacm/prov/acmp/src/acmp.c
@@ -656,7 +656,7 @@ acmp_record_mc_av(struct acmp_port *port, struct ib_mc_member_rec *mc_rec,
 	dest->path.dgid = mc_rec->mgid;
 	dest->path.sgid = mc_rec->port_gid;
 	dest->path.dlid = mc_rec->mlid;
-	dest->path.slid = htobe16(port->lid) | port->sa_dest.av.src_path_bits;
+	dest->path.slid = htobe16(port->lid | port->sa_dest.av.src_path_bits);
 	dest->path.flowlabel_hoplimit = htobe32(sl_flow_hop & 0xFFFFFFF);
 	dest->path.tclass = mc_rec->tclass;
 	dest->path.reversible_numpath = IBV_PATH_RECORD_REVERSIBLE | 1;
@@ -675,7 +675,7 @@ acmp_init_path_av(struct acmp_port *port, struct acmp_dest *dest)
 
 	dest->av.dlid = be16toh(dest->path.dlid);
 	dest->av.sl = be16toh(dest->path.qosclass_sl) & 0xF;
-	dest->av.src_path_bits = dest->path.slid & 0x7F;
+	dest->av.src_path_bits = be16toh(dest->path.slid) & 0x7F;
 	dest->av.static_rate = dest->path.rate & 0x3F;
 	dest->av.port_num = port->port_num;
 
diff --git a/librdmacm/rsocket.c b/librdmacm/rsocket.c
index 2742b7bd982d7b..db06a9c3b1c5ee 100644
--- a/librdmacm/rsocket.c
+++ b/librdmacm/rsocket.c
@@ -4103,7 +4103,7 @@ static void udp_svc_create_ah(struct rsocket *rs, struct ds_dest *dest, uint32_t
 	}
 	attr.dlid = be16toh(id->route.path_rec->dlid);
 	attr.sl = id->route.path_rec->sl;
-	attr.src_path_bits = id->route.path_rec->slid & udp_svc_path_bits(dest);
+	attr.src_path_bits = be16toh(id->route.path_rec->slid) & udp_svc_path_bits(dest);
 	attr.static_rate = id->route.path_rec->rate;
 	attr.port_num  = id->port_num;
 
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH rdma-core 3/7] Fix various missing swaps in debugging/logging macros
       [not found] ` <1489508474-16664-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  2017-03-14 16:21   ` [PATCH rdma-core 1/7] Drop debugging print in CMakeLists.txt Jason Gunthorpe
  2017-03-14 16:21   ` [PATCH rdma-core 2/7] Fix missing swaps when computing path bits Jason Gunthorpe
@ 2017-03-14 16:21   ` Jason Gunthorpe
       [not found]     ` <1489508474-16664-4-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  2017-03-14 16:21   ` [PATCH rdma-core 4/7] Add missing statics Jason Gunthorpe
                     ` (4 subsequent siblings)
  7 siblings, 1 reply; 13+ messages in thread
From: Jason Gunthorpe @ 2017-03-14 16:21 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Ram Amrani, Ariel Elior

Based on sparse output.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 ibacm/prov/acmp/src/acmp.c  | 13 +++++++------
 ibacm/src/acm.c             |  4 ++--
 providers/qedr/qelr_verbs.c |  4 ++--
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/ibacm/prov/acmp/src/acmp.c b/ibacm/prov/acmp/src/acmp.c
index da4e69cd171f5b..fb8d30f3e6ac42 100644
--- a/ibacm/prov/acmp/src/acmp.c
+++ b/ibacm/prov/acmp/src/acmp.c
@@ -2419,8 +2419,8 @@ static struct acmp_port *acmp_get_port(struct acm_endpoint *endpoint)
 	struct acmp_device *dev;
 
 	acm_log(1, "dev 0x%" PRIx64 " port %d pkey 0x%x\n",
-		endpoint->port->dev->dev_guid, endpoint->port->port_num,
-		endpoint->pkey);
+		be64toh(endpoint->port->dev->dev_guid),
+		endpoint->port->port_num, endpoint->pkey);
 
 	list_for_each(&acmp_dev_list, dev, entry) {
 		if (dev->guid == endpoint->port->dev->dev_guid)
@@ -2436,7 +2436,8 @@ acmp_get_ep(struct acmp_port *port, struct acm_endpoint *endpoint)
 	struct acmp_ep *ep;
 
 	acm_log(1, "dev 0x%" PRIx64 " port %d pkey 0x%x\n",
-		endpoint->port->dev->dev_guid, endpoint->port->port_num, endpoint->pkey);
+		be64toh(endpoint->port->dev->dev_guid),
+		endpoint->port->port_num, endpoint->pkey);
 
 	list_for_each(&port->ep_list, ep, entry) {
 		if (ep->pkey == endpoint->pkey)
@@ -2736,13 +2737,13 @@ static int acmp_open_dev(const struct acm_device *device, void **dev_context)
 	int i, ret;
 	struct ibv_context *verbs;
 
-	acm_log(1, "dev_guid 0x%" PRIx64 " %s\n", device->dev_guid,
+	acm_log(1, "dev_guid 0x%" PRIx64 " %s\n", be64toh(device->dev_guid),
 		device->verbs->device->name);
 
 	list_for_each(&acmp_dev_list, dev, entry) {
 		if (dev->guid == device->dev_guid) {
 			acm_log(2, "dev_guid 0x%" PRIx64 " already exits\n",
-				device->dev_guid);
+				be64toh(device->dev_guid));
 			*dev_context = dev;
 			dev->device = device;
 			return 0;
@@ -2823,7 +2824,7 @@ static void acmp_close_dev(void *dev_context)
 {
 	struct acmp_device *dev = dev_context;
 
-	acm_log(1, "dev_guid 0x%" PRIx64 "\n", dev->device->dev_guid);
+	acm_log(1, "dev_guid 0x%" PRIx64 "\n", be64toh(dev->device->dev_guid));
 	dev->device = NULL;
 }
 
diff --git a/ibacm/src/acm.c b/ibacm/src/acm.c
index 3550b11b324570..f3512dac106815 100644
--- a/ibacm/src/acm.c
+++ b/ibacm/src/acm.c
@@ -2136,8 +2136,8 @@ static void acm_port_get_gid_tbl(struct acmc_port *port)
 			if (ret || !port->gid_tbl[j].global.interface_id)
 				break;
 			acm_log(2, "guid %d: 0x%" PRIx64 " %" PRIx64 "\n", j,
-				port->gid_tbl[j].global.subnet_prefix,
-				port->gid_tbl[j].global.interface_id);
+				be64toh(port->gid_tbl[j].global.subnet_prefix),
+				be64toh(port->gid_tbl[j].global.interface_id));
 		}
 		port->gid_cnt = j;
 	}
diff --git a/providers/qedr/qelr_verbs.c b/providers/qedr/qelr_verbs.c
index 4800a4b0f43e6f..8d94a122a2b871 100644
--- a/providers/qedr/qelr_verbs.c
+++ b/providers/qedr/qelr_verbs.c
@@ -561,8 +561,8 @@ static void qelr_print_ah_attr(struct qelr_devctx *cxt, struct ibv_ah_attr *attr
 {
 	DP_VERBOSE(cxt->dbg_fp, QELR_MSG_QP,
 		   "grh.dgid=[%#" PRIx64 ":%#" PRIx64 "], grh.flow_label=%d, grh.sgid_index=%d, grh.hop_limit=%d, grh.traffic_class=%d, dlid=%d, sl=%d, src_path_bits=%d, static_rate = %d, port_num=%d\n",
-		   attr->grh.dgid.global.interface_id,
-		   attr->grh.dgid.global.subnet_prefix,
+		   be64toh(attr->grh.dgid.global.interface_id),
+		   be64toh(attr->grh.dgid.global.subnet_prefix),
 		   attr->grh.flow_label, attr->grh.hop_limit,
 		   attr->grh.sgid_index, attr->grh.traffic_class, attr->dlid,
 		   attr->sl, attr->src_path_bits,
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH rdma-core 4/7] Add missing statics
       [not found] ` <1489508474-16664-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
                     ` (2 preceding siblings ...)
  2017-03-14 16:21   ` [PATCH rdma-core 3/7] Fix various missing swaps in debugging/logging macros Jason Gunthorpe
@ 2017-03-14 16:21   ` Jason Gunthorpe
  2017-03-14 16:21   ` [PATCH rdma-core 5/7] acm: Fix incorrect TID masking Jason Gunthorpe
                     ` (3 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Jason Gunthorpe @ 2017-03-14 16:21 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Doug Ledford, Yishai Hadas

>From sparse

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 libibverbs/examples/xsrq_pingpong.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libibverbs/examples/xsrq_pingpong.c b/libibverbs/examples/xsrq_pingpong.c
index 5fb8827579ddb1..31a86f7c8360e2 100644
--- a/libibverbs/examples/xsrq_pingpong.c
+++ b/libibverbs/examples/xsrq_pingpong.c
@@ -97,7 +97,7 @@ struct pingpong_context {
 	int			 gidx;
 };
 
-struct pingpong_context ctx;
+static struct pingpong_context ctx;
 
 
 static int open_device(char *ib_devname)
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH rdma-core 5/7] acm: Fix incorrect TID masking
       [not found] ` <1489508474-16664-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
                     ` (3 preceding siblings ...)
  2017-03-14 16:21   ` [PATCH rdma-core 4/7] Add missing statics Jason Gunthorpe
@ 2017-03-14 16:21   ` Jason Gunthorpe
  2017-03-14 16:21   ` [PATCH rdma-core 6/7] cmpost: Add missing swap for sin_port Jason Gunthorpe
                     ` (2 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Jason Gunthorpe @ 2017-03-14 16:21 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA

The kernel uses the upper 32 bits of the TID for the agent ID
(see drivers/infiniband/core/user_mad.c ib_umad_write)

This worked on x86 because the TID is in BE at this point and the upper
32 bit masking is correct when working with BE data.

Noticed by sparse.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 ibacm/src/acm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ibacm/src/acm.c b/ibacm/src/acm.c
index f3512dac106815..cf107815221b14 100644
--- a/ibacm/src/acm.c
+++ b/ibacm/src/acm.c
@@ -2770,8 +2770,8 @@ static void acmc_recv_mad(struct acmc_port *port)
 	found = 0;
 	pthread_mutex_lock(&port->lock);
 	list_for_each(&port->sa_pending, req, entry) {
-		/* The lower 32-bit of the tid is used for agentid in umad */
-		if (req->mad.sa_mad.mad_hdr.tid == (hdr->tid & 0xFFFFFFFF00000000ULL)) {
+		/* The upper 32-bit of the tid is used for agentid in umad */
+		if (req->mad.sa_mad.mad_hdr.tid == (hdr->tid & htobe64(0xFFFFFFFF))) {
 			found = 1;
 			list_del(&req->entry);
 			port->sa_credits++;
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH rdma-core 6/7] cmpost: Add missing swap for sin_port
       [not found] ` <1489508474-16664-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
                     ` (4 preceding siblings ...)
  2017-03-14 16:21   ` [PATCH rdma-core 5/7] acm: Fix incorrect TID masking Jason Gunthorpe
@ 2017-03-14 16:21   ` Jason Gunthorpe
       [not found]     ` <1489508474-16664-7-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  2017-03-14 16:21   ` [PATCH rdma-core 7/7] acm: Fix missing swap in pkey compare Jason Gunthorpe
  2017-03-21 17:25   ` [PATCH rdma-core 0/7] Bugs found by sparse Doug Ledford
  7 siblings, 1 reply; 13+ messages in thread
From: Jason Gunthorpe @ 2017-03-14 16:21 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Sean Hefty

It looks like this didn't matter because this sin_port is only used
for resolve_route which doesn't use sin_port data.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 libibcm/examples/cmpost.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libibcm/examples/cmpost.c b/libibcm/examples/cmpost.c
index b8e7d8e0710e6d..b7c95513959390 100644
--- a/libibcm/examples/cmpost.c
+++ b/libibcm/examples/cmpost.c
@@ -632,7 +632,7 @@ static int get_dst_addr(char *dst, struct sockaddr_in *addr_in)
 	}
 
 	*addr_in = *(struct sockaddr_in *) res->ai_addr;
-	addr_in->sin_port = 7471;
+	addr_in->sin_port = htobe16(7471);
 out:
 	freeaddrinfo(res);
 	return ret;
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH rdma-core 7/7] acm: Fix missing swap in pkey compare
       [not found] ` <1489508474-16664-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
                     ` (5 preceding siblings ...)
  2017-03-14 16:21   ` [PATCH rdma-core 6/7] cmpost: Add missing swap for sin_port Jason Gunthorpe
@ 2017-03-14 16:21   ` Jason Gunthorpe
  2017-03-21 17:25   ` [PATCH rdma-core 0/7] Bugs found by sparse Doug Ledford
  7 siblings, 0 replies; 13+ messages in thread
From: Jason Gunthorpe @ 2017-03-14 16:21 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA

It looks like endpoint->pkey is always used as host except for here. The
routine always returns 0 on failure, so it is likely nobody noticed it
was wrong.

Found by sparse.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 ibacm/prov/acmp/src/acmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ibacm/prov/acmp/src/acmp.c b/ibacm/prov/acmp/src/acmp.c
index fb8d30f3e6ac42..024d401fbf9fbd 100644
--- a/ibacm/prov/acmp/src/acmp.c
+++ b/ibacm/prov/acmp/src/acmp.c
@@ -2459,7 +2459,7 @@ static uint16_t acmp_get_pkey_index(struct acm_endpoint *endpoint)
 
 	for (i = 0, ret = 0; !ret; i++) {
 		ret = ibv_query_pkey(port->dev->verbs, port->port_num, i, &pkey);
-		if (!ret && endpoint->pkey == pkey)
+		if (!ret && endpoint->pkey == be16toh(pkey))
 			return i;
 	}
 	return 0;
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* RE: [PATCH rdma-core 2/7] Fix missing swaps when computing path bits
       [not found]     ` <1489508474-16664-3-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2017-03-14 17:09       ` Hefty, Sean
  0 siblings, 0 replies; 13+ messages in thread
From: Hefty, Sean @ 2017-03-14 17:09 UTC (permalink / raw)
  To: Jason Gunthorpe,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

> Sparse says the slid is BE in this context.
> 
> Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

Acked-by: Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Thanks - these changes all look correct.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [PATCH rdma-core 6/7] cmpost: Add missing swap for sin_port
       [not found]     ` <1489508474-16664-7-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2017-03-14 17:10       ` Hefty, Sean
  0 siblings, 0 replies; 13+ messages in thread
From: Hefty, Sean @ 2017-03-14 17:10 UTC (permalink / raw)
  To: Jason Gunthorpe,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

Acked-by: Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [PATCH rdma-core 3/7] Fix various missing swaps in debugging/logging macros
       [not found]     ` <1489508474-16664-4-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2017-03-15  7:24       ` Amrani, Ram
       [not found]         ` <SN1PR07MB22075A6E4341F141A27692ECF8270-mikhvbZlbf8TSoR2DauN2+FPX92sqiQdvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Amrani, Ram @ 2017-03-15  7:24 UTC (permalink / raw)
  To: Jason Gunthorpe,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
  Cc: Elior, Ariel

> Based on sparse output.
> 
> Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
> ---
>  ibacm/prov/acmp/src/acmp.c  | 13 +++++++------
>  ibacm/src/acm.c             |  4 ++--
>  providers/qedr/qelr_verbs.c |  4 ++--
>  3 files changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/ibacm/prov/acmp/src/acmp.c b/ibacm/prov/acmp/src/acmp.c
> index da4e69cd171f5b..fb8d30f3e6ac42 100644
> --- a/ibacm/prov/acmp/src/acmp.c
> +++ b/ibacm/prov/acmp/src/acmp.c
> @@ -2419,8 +2419,8 @@ static struct acmp_port *acmp_get_port(struct acm_endpoint *endpoint)
>  	struct acmp_device *dev;
> 
>  	acm_log(1, "dev 0x%" PRIx64 " port %d pkey 0x%x\n",
> -		endpoint->port->dev->dev_guid, endpoint->port->port_num,
> -		endpoint->pkey);
> +		be64toh(endpoint->port->dev->dev_guid),
> +		endpoint->port->port_num, endpoint->pkey);
> 
>  	list_for_each(&acmp_dev_list, dev, entry) {
>  		if (dev->guid == endpoint->port->dev->dev_guid)
> @@ -2436,7 +2436,8 @@ acmp_get_ep(struct acmp_port *port, struct acm_endpoint *endpoint)
>  	struct acmp_ep *ep;
> 
>  	acm_log(1, "dev 0x%" PRIx64 " port %d pkey 0x%x\n",
> -		endpoint->port->dev->dev_guid, endpoint->port->port_num, endpoint->pkey);
> +		be64toh(endpoint->port->dev->dev_guid),
> +		endpoint->port->port_num, endpoint->pkey);
> 
>  	list_for_each(&port->ep_list, ep, entry) {
>  		if (ep->pkey == endpoint->pkey)
> @@ -2736,13 +2737,13 @@ static int acmp_open_dev(const struct acm_device *device, void **dev_context)
>  	int i, ret;
>  	struct ibv_context *verbs;
> 
> -	acm_log(1, "dev_guid 0x%" PRIx64 " %s\n", device->dev_guid,
> +	acm_log(1, "dev_guid 0x%" PRIx64 " %s\n", be64toh(device->dev_guid),
>  		device->verbs->device->name);
> 
>  	list_for_each(&acmp_dev_list, dev, entry) {
>  		if (dev->guid == device->dev_guid) {
>  			acm_log(2, "dev_guid 0x%" PRIx64 " already exits\n",
> -				device->dev_guid);
> +				be64toh(device->dev_guid));
>  			*dev_context = dev;
>  			dev->device = device;
>  			return 0;
> @@ -2823,7 +2824,7 @@ static void acmp_close_dev(void *dev_context)
>  {
>  	struct acmp_device *dev = dev_context;
> 
> -	acm_log(1, "dev_guid 0x%" PRIx64 "\n", dev->device->dev_guid);
> +	acm_log(1, "dev_guid 0x%" PRIx64 "\n", be64toh(dev->device->dev_guid));
>  	dev->device = NULL;
>  }
> 
> diff --git a/ibacm/src/acm.c b/ibacm/src/acm.c
> index 3550b11b324570..f3512dac106815 100644
> --- a/ibacm/src/acm.c
> +++ b/ibacm/src/acm.c
> @@ -2136,8 +2136,8 @@ static void acm_port_get_gid_tbl(struct acmc_port *port)
>  			if (ret || !port->gid_tbl[j].global.interface_id)
>  				break;
>  			acm_log(2, "guid %d: 0x%" PRIx64 " %" PRIx64 "\n", j,
> -				port->gid_tbl[j].global.subnet_prefix,
> -				port->gid_tbl[j].global.interface_id);
> +				be64toh(port->gid_tbl[j].global.subnet_prefix),
> +				be64toh(port->gid_tbl[j].global.interface_id));
>  		}
>  		port->gid_cnt = j;
>  	}
> diff --git a/providers/qedr/qelr_verbs.c b/providers/qedr/qelr_verbs.c
> index 4800a4b0f43e6f..8d94a122a2b871 100644
> --- a/providers/qedr/qelr_verbs.c
> +++ b/providers/qedr/qelr_verbs.c
> @@ -561,8 +561,8 @@ static void qelr_print_ah_attr(struct qelr_devctx *cxt, struct ibv_ah_attr *attr
>  {
>  	DP_VERBOSE(cxt->dbg_fp, QELR_MSG_QP,
>  		   "grh.dgid=[%#" PRIx64 ":%#" PRIx64 "], grh.flow_label=%d, grh.sgid_index=%d, grh.hop_limit=%d,
> grh.traffic_class=%d, dlid=%d, sl=%d, src_path_bits=%d, static_rate = %d, port_num=%d\n",
> -		   attr->grh.dgid.global.interface_id,
> -		   attr->grh.dgid.global.subnet_prefix,
> +		   be64toh(attr->grh.dgid.global.interface_id),
> +		   be64toh(attr->grh.dgid.global.subnet_prefix),
>  		   attr->grh.flow_label, attr->grh.hop_limit,
>  		   attr->grh.sgid_index, attr->grh.traffic_class, attr->dlid,
>  		   attr->sl, attr->src_path_bits,
> --
> 2.7.4

Thanks Jason.
How did sparse "know" what is little/big endian and where to use each?

Acked-by: Ram Amrani <Ram.Amrani-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH rdma-core 3/7] Fix various missing swaps in debugging/logging macros
       [not found]         ` <SN1PR07MB22075A6E4341F141A27692ECF8270-mikhvbZlbf8TSoR2DauN2+FPX92sqiQdvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
@ 2017-03-15 15:58           ` Jason Gunthorpe
  0 siblings, 0 replies; 13+ messages in thread
From: Jason Gunthorpe @ 2017-03-15 15:58 UTC (permalink / raw)
  To: Amrani, Ram
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Elior, Ariel

On Wed, Mar 15, 2017 at 07:24:06AM +0000, Amrani, Ram wrote:

> How did sparse "know" what is little/big endian and where to use each?

It is like the kernel, we have to add __be32/etc all over the place

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH rdma-core 0/7] Bugs found by sparse
       [not found] ` <1489508474-16664-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
                     ` (6 preceding siblings ...)
  2017-03-14 16:21   ` [PATCH rdma-core 7/7] acm: Fix missing swap in pkey compare Jason Gunthorpe
@ 2017-03-21 17:25   ` Doug Ledford
  7 siblings, 0 replies; 13+ messages in thread
From: Doug Ledford @ 2017-03-21 17:25 UTC (permalink / raw)
  To: Jason Gunthorpe, linux-rdma-u79uwXL29TY76Z2rM5mHXA

On Tue, 2017-03-14 at 10:21 -0600, Jason Gunthorpe wrote:
> Since Bart got sparse working I took a quick look at what is in the
> core
> libaries, these cases look like bugs to me.
> 
> I have another series that adds lots of sparse annotations to send
> later..
> 
> https://github.com/linux-rdma/rdma-core/pull/97
> 
> Jason Gunthorpe (7):
>   Drop debugging print in CMakeLists.txt
>   Fix missing swaps when computing path bits
>   Fix various missing swaps in debugging/logging macros
>   Add missing statics
>   acm: Fix incorrect TID masking
>   cmpost: Add missing swap for sin_port
>   acm: Fix missing swap in pkey compare
> 
>  CMakeLists.txt                      |  1 -
>  ibacm/prov/acmp/src/acmp.c          | 19 ++++++++++---------
>  ibacm/src/acm.c                     |  8 ++++----
>  libibcm/examples/cmpost.c           |  2 +-
>  libibverbs/examples/xsrq_pingpong.c |  2 +-
>  librdmacm/rsocket.c                 |  2 +-
>  providers/qedr/qelr_verbs.c         |  4 ++--
>  7 files changed, 19 insertions(+), 19 deletions(-)

This merge request was dropped (by Jason) for a later merge request.
 The later merge request has been merged (#101).  Thanks Jason.

-- 
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
    GPG KeyID: B826A3330E572FDD
   
Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-03-21 17:25 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-14 16:21 [PATCH rdma-core 0/7] Bugs found by sparse Jason Gunthorpe
     [not found] ` <1489508474-16664-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-03-14 16:21   ` [PATCH rdma-core 1/7] Drop debugging print in CMakeLists.txt Jason Gunthorpe
2017-03-14 16:21   ` [PATCH rdma-core 2/7] Fix missing swaps when computing path bits Jason Gunthorpe
     [not found]     ` <1489508474-16664-3-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-03-14 17:09       ` Hefty, Sean
2017-03-14 16:21   ` [PATCH rdma-core 3/7] Fix various missing swaps in debugging/logging macros Jason Gunthorpe
     [not found]     ` <1489508474-16664-4-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-03-15  7:24       ` Amrani, Ram
     [not found]         ` <SN1PR07MB22075A6E4341F141A27692ECF8270-mikhvbZlbf8TSoR2DauN2+FPX92sqiQdvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-03-15 15:58           ` Jason Gunthorpe
2017-03-14 16:21   ` [PATCH rdma-core 4/7] Add missing statics Jason Gunthorpe
2017-03-14 16:21   ` [PATCH rdma-core 5/7] acm: Fix incorrect TID masking Jason Gunthorpe
2017-03-14 16:21   ` [PATCH rdma-core 6/7] cmpost: Add missing swap for sin_port Jason Gunthorpe
     [not found]     ` <1489508474-16664-7-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-03-14 17:10       ` Hefty, Sean
2017-03-14 16:21   ` [PATCH rdma-core 7/7] acm: Fix missing swap in pkey compare Jason Gunthorpe
2017-03-21 17:25   ` [PATCH rdma-core 0/7] Bugs found by sparse Doug Ledford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox