diff options
author | Omar Sandoval <osandov@fb.com> | 2018-09-28 12:22:50 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-09-28 12:49:39 -0400 |
commit | f0a0cdddb14c7a32e7ca68f45fbc44aa347e959d (patch) | |
tree | 7ff5182cf80287cedc531edd29c6a9c96b3f96e1 /block/kyber-iosched.c | |
parent | e982c4d0a29b1d61fbe7716a8dcf8984936d6730 (diff) |
kyber: fix integer overflow of latency targets on 32-bit
NSEC_PER_SEC has type long, so 5 * NSEC_PER_SEC is calculated as a long.
However, 5 seconds is 5,000,000,000 nanoseconds, which overflows a
32-bit long. Make sure all of the targets are calculated as 64-bit
values.
Fixes: 6e25cb01ea20 ("kyber: implement improved heuristics")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/kyber-iosched.c')
-rw-r--r-- | block/kyber-iosched.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/block/kyber-iosched.c b/block/kyber-iosched.c index 2b62e362fb36..eccac01a10b6 100644 --- a/block/kyber-iosched.c +++ b/block/kyber-iosched.c | |||
@@ -79,9 +79,9 @@ static const unsigned int kyber_depth[] = { | |||
79 | * Default latency targets for each scheduling domain. | 79 | * Default latency targets for each scheduling domain. |
80 | */ | 80 | */ |
81 | static const u64 kyber_latency_targets[] = { | 81 | static const u64 kyber_latency_targets[] = { |
82 | [KYBER_READ] = 2 * NSEC_PER_MSEC, | 82 | [KYBER_READ] = 2ULL * NSEC_PER_MSEC, |
83 | [KYBER_WRITE] = 10 * NSEC_PER_MSEC, | 83 | [KYBER_WRITE] = 10ULL * NSEC_PER_MSEC, |
84 | [KYBER_DISCARD] = 5 * NSEC_PER_SEC, | 84 | [KYBER_DISCARD] = 5ULL * NSEC_PER_SEC, |
85 | }; | 85 | }; |
86 | 86 | ||
87 | /* | 87 | /* |