From: Doug Ledford <dledford@redhat.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
Mike Marciniszyn <mike.marciniszyn@intel.com>
Cc: Dennis Dalessandro <dennis.dalessandro@intel.com>,
Sean Hefty <sean.hefty@intel.com>,
Hal Rosenstock <hal.rosenstock@gmail.com>,
linux-rdma@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] IB/hfi1: Fix a wrapping test (make it less strict)
Date: Mon, 23 Oct 2017 11:05:16 -0400 [thread overview]
Message-ID: <1508771116.3325.0.camel@redhat.com> (raw)
In-Reply-To: <20171013105559.tqzh6jhcnvmqhdwy@mwanda>
On Fri, 2017-10-13 at 13:56 +0300, Dan Carpenter wrote:
> 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@oracle.com>
> ---
> 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,
Denny, I'm looking for feedback from you on this patch. This fixes a
bug, my only concern is that the code used to work with the bug, could
this make the code not work?
--
Doug Ledford <dledford@redhat.com>
GPG KeyID: B826A3330E572FDD
Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD
next prev parent reply other threads:[~2017-10-23 15:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
[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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1508771116.3325.0.camel@redhat.com \
--to=dledford@redhat.com \
--cc=dan.carpenter@oracle.com \
--cc=dennis.dalessandro@intel.com \
--cc=hal.rosenstock@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mike.marciniszyn@intel.com \
--cc=sean.hefty@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox