public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IB/hfi1: Fix a wrapping test (make it less strict)
@ 2017-10-13 10:56 Dan Carpenter
  2017-10-23 15:05 ` Doug Ledford
  0 siblings, 1 reply; 10+ messages in thread
From: Dan Carpenter @ 2017-10-13 10:56 UTC (permalink / raw)
  To: Mike Marciniszyn
  Cc: Dennis Dalessandro, Doug Ledford, Sean Hefty, Hal Rosenstock,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

The "2 * UINT_MAX" overflows so the test is essentially doing this:

	if ((u64)(ts - cce->timestamp) > UINT_MAX - 1) {

I've changed it to a 64bit type.

Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
---
Not tested.

diff --git a/drivers/infiniband/hw/hfi1/mad.c b/drivers/infiniband/hw/hfi1/mad.c
index f4c0ffc040cc..3aeea8afd44f 100644
--- a/drivers/infiniband/hw/hfi1/mad.c
+++ b/drivers/infiniband/hw/hfi1/mad.c
@@ -3781,7 +3781,7 @@ static int __subn_get_opa_hfi1_cong_log(struct opa_smp *smp, u32 am,
 		 * required to wrap the counter are supposed to
 		 * be zeroed (CA10-49 IBTA, release 1.2.1, V1).
 		 */
-		if ((u64)(ts - cce->timestamp) > (2 * UINT_MAX))
+		if ((u64)(ts - cce->timestamp) > (2ULL * UINT_MAX))
 			continue;
 		memcpy(cong_log->events[i].local_qp_cn_entry, &cce->lqpn, 3);
 		memcpy(cong_log->events[i].remote_qp_number_cn_entry,
--
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] 10+ messages in thread

end of thread, other threads:[~2017-10-25  5:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-13 10:56 [PATCH] IB/hfi1: Fix a wrapping test (make it less strict) Dan Carpenter
2017-10-23 15:05 ` Doug Ledford
     [not found]   ` <1508771116.3325.0.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-10-23 17:57     ` Dennis Dalessandro
2017-10-23 18:33       ` Doug Ledford
2017-10-23 19:04         ` Jason Gunthorpe
2017-10-24 19:54           ` Marciniszyn, Mike
     [not found]             ` <32E1700B9017364D9B60AED9960492BC3443EB1C-RjuIdWtd+YbTXloPLtfHfbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2017-10-24 20:02               ` Jason Gunthorpe
     [not found]                 ` <20171024200216.GA15994-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-10-24 20:03                   ` Marciniszyn, Mike
2017-10-25  5:27                   ` Dan Carpenter
2017-10-25  5:14               ` Dan Carpenter

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