Home
last modified time | relevance | path

Searched hist:d61ea0751aa097182291c7ceed447bc73e020109 (Results 1 – 3 of 3) sorted by relevance

/openbmc/linux/drivers/infiniband/hw/hfi1/
H A Dmad.hdiff d61ea0751aa097182291c7ceed447bc73e020109 Mon Nov 06 08:38:38 CST 2017 Mike Marciniszyn <mike.marciniszyn@intel.com> IB/hfi1: Fix a wrapping test to insure the correct timeout

The "2 * UINT_MAX" statement:
if ((u64)(ts - cce->timestamp) > 2 * UINT_MAX) {

is equivalent to:
if ((u64)(ts - cce->timestamp) > UINT_MAX - 1) {

This results in a premature timeout of the cong log entry.

Fix by using unsigned 64 bit integers, removing casts, and using
an algebraic equivalent test to avoid the "2 * UINT_MAX" issue.

Also make use of kernel API to get nanoseconds instead of
open coding.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
H A Dmad.cdiff d61ea0751aa097182291c7ceed447bc73e020109 Mon Nov 06 08:38:38 CST 2017 Mike Marciniszyn <mike.marciniszyn@intel.com> IB/hfi1: Fix a wrapping test to insure the correct timeout

The "2 * UINT_MAX" statement:
if ((u64)(ts - cce->timestamp) > 2 * UINT_MAX) {

is equivalent to:
if ((u64)(ts - cce->timestamp) > UINT_MAX - 1) {

This results in a premature timeout of the cong log entry.

Fix by using unsigned 64 bit integers, removing casts, and using
an algebraic equivalent test to avoid the "2 * UINT_MAX" issue.

Also make use of kernel API to get nanoseconds instead of
open coding.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
H A Drc.cdiff d61ea0751aa097182291c7ceed447bc73e020109 Mon Nov 06 08:38:38 CST 2017 Mike Marciniszyn <mike.marciniszyn@intel.com> IB/hfi1: Fix a wrapping test to insure the correct timeout

The "2 * UINT_MAX" statement:
if ((u64)(ts - cce->timestamp) > 2 * UINT_MAX) {

is equivalent to:
if ((u64)(ts - cce->timestamp) > UINT_MAX - 1) {

This results in a premature timeout of the cong log entry.

Fix by using unsigned 64 bit integers, removing casts, and using
an algebraic equivalent test to avoid the "2 * UINT_MAX" issue.

Also make use of kernel API to get nanoseconds instead of
open coding.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>