nfs4: Fix CID #1032280: Prevent integer overflow
* Do not increase delay after tenth attempt * Cast 1 to bigtime_t before shifting it left
This commit is contained in:
@@ -17,9 +17,9 @@
|
||||
static inline bigtime_t
|
||||
RetryDelay(uint32 attempt, uint32 leaseTime = 0)
|
||||
{
|
||||
attempt = min_c(attempt, sizeof(bigtime_t) * 8);
|
||||
attempt = min_c(attempt, 10);
|
||||
|
||||
bigtime_t delay = (1 << (attempt - 1)) * 100000;
|
||||
bigtime_t delay = (bigtime_t(1) << (attempt - 1)) * 100000;
|
||||
if (leaseTime != 0)
|
||||
delay = min_c(delay, sSecToBigTime(leaseTime));
|
||||
return delay;
|
||||
|
||||
Reference in New Issue
Block a user