RDMA/hfi1: Fix potential integer multiplication overflow errors
commitf93e91a037upstream. 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:7724105686("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
09408080ad
commit
31dca00d0c
@@ -530,7 +530,7 @@ void set_link_ipg(struct hfi1_pportdata *ppd)
|
||||
u16 shift, mult;
|
||||
u64 src;
|
||||
u32 current_egress_rate; /* Mbits /sec */
|
||||
u32 max_pkt_time;
|
||||
u64 max_pkt_time;
|
||||
/*
|
||||
* max_pkt_time is the maximum packet egress time in units
|
||||
* of the fabric clock period 1/(805 MHz).
|
||||
|
||||
Reference in New Issue
Block a user