Skip to content

Commit ef5ab2e

Browse files
ddalessagregkh
authored andcommitted
RDMA/hfi1: Fix potential integer multiplication overflow errors
commit f93e91a upstream. 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: [email protected] Fixes: 7724105 ("IB/hfi1: add driver files") Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Mike Marciniszyn <[email protected]> Signed-off-by: Dennis Dalessandro <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent bf29eda commit ef5ab2e

File tree

1 file changed

+1
-1
lines changed
  • drivers/infiniband/hw/hfi1

1 file changed

+1
-1
lines changed

drivers/infiniband/hw/hfi1/init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ void set_link_ipg(struct hfi1_pportdata *ppd)
489489
u16 shift, mult;
490490
u64 src;
491491
u32 current_egress_rate; /* Mbits /sec */
492-
u32 max_pkt_time;
492+
u64 max_pkt_time;
493493
/*
494494
* max_pkt_time is the maximum packet egress time in units
495495
* of the fabric clock period 1/(805 MHz).

0 commit comments

Comments
 (0)