]> git.baikalelectronics.ru Git - kernel.git/commit
RDMA/hfi1: Fix potential integer multiplication overflow errors
authorDennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
Fri, 20 May 2022 18:37:12 +0000 (14:37 -0400)
committerJason Gunthorpe <jgg@nvidia.com>
Tue, 24 May 2022 18:08:31 +0000 (15:08 -0300)
commitcfeb4eea8fe5a68cda369e9b91c46d8381af427d
tree10cf6219d37e5fdc9eddb2fe25cca4d342dff756
parent0cea44f50a6dbeb5b72338bf5afc4f515a749e17
RDMA/hfi1: Fix potential integer multiplication overflow errors

When multiplying of different types, an overflow is possible even when
storing the result in a larger type. This is because the conversion is
done after the multiplication. So arithmetic overflow and thus in
incorrect value is possible.

Correct an instance of this in the inter packet delay calculation.  Fix by
ensuring one of the operands is u64 which will promote the other to u64 as
well ensuring no overflow.

Cc: stable@vger.kernel.org
Fixes: 458784dfebc5 ("IB/hfi1: add driver files")
Link: https://lore.kernel.org/r/20220520183712.48973.29855.stgit@awfm-01.cornelisnetworks.com
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/hfi1/init.c