Skip to contentSkip to conversation

linux-next: build warning after merge of the block tree

DISCUSSION Stephen Rothwell 3 participants 3 messages Sep 28, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Jens,

After merging the block tree, today's linux-next build (arm multi_v7_defconfig) produced this warning:

block/kyber-iosched.c:84:22: warning: integer overflow in expression of type 'long int' results in '705032704' [-Woverflow]
[KYBER_DISCARD] = 5 * NSEC_PER_SEC,

                      ^

Introduced by commit

6e25cb01ea20 ("kyber: implement improved heuristics")

Signature · 2 lines
Cheers,
Stephen Rothwell
#1 lore raw
Quoted 5 lines · Stephen Rothwell

Hi Jens,

After merging the block tree, today's linux-next build (arm multi_v7_defconfig) produced this warning:

Quoted 7 lines

block/kyber-iosched.c:84:22: warning: integer overflow in expression of type 'long int' results in '705032704' [-Woverflow]
[KYBER_DISCARD] = 5 * NSEC_PER_SEC,

                      ^

Introduced by commit

6e25cb01ea20 ("kyber: implement improved heuristics")

Ugh, thanks for the report. This should fix it:

block/kyber-iosched.c +3 -3
index 2b62e362fb36..eccac01a10b6 100644
@@ -79,9 +79,9 @@ static const unsigned int kyber_depth[] = {
  * Default latency targets for each scheduling domain.
  */
 static const u64 kyber_latency_targets[] = {
-	[KYBER_READ] = 2 * NSEC_PER_MSEC,
-	[KYBER_WRITE] = 10 * NSEC_PER_MSEC,
-	[KYBER_DISCARD] = 5 * NSEC_PER_SEC,
+	[KYBER_READ] = 2ULL * NSEC_PER_MSEC,
+	[KYBER_WRITE] = 10ULL * NSEC_PER_MSEC,
+	[KYBER_DISCARD] = 5ULL * NSEC_PER_SEC,
 };
 
 /*

Jens, do you mind folding that in, or should I send it separately?

maintainer
#2 lore raw
Quoted 34 lines · Omar Sandoval
Quoted 5 lines · Stephen Rothwell

Hi Jens,

After merging the block tree, today's linux-next build (arm multi_v7_defconfig) produced this warning:

Quoted 7 lines

block/kyber-iosched.c:84:22: warning: integer overflow in expression of type 'long int' results in '705032704' [-Woverflow]
[KYBER_DISCARD] = 5 * NSEC_PER_SEC,

                      ^

Introduced by commit

6e25cb01ea20 ("kyber: implement improved heuristics")

Ugh, thanks for the report. This should fix it:

block/kyber-iosched.c +3 -3
index 2b62e362fb36..eccac01a10b6 100644
@@ -79,9 +79,9 @@ static const unsigned int kyber_depth[] = {
  * Default latency targets for each scheduling domain.
  */
 static const u64 kyber_latency_targets[] = {
-	[KYBER_READ] = 2 * NSEC_PER_MSEC,
-	[KYBER_WRITE] = 10 * NSEC_PER_MSEC,
-	[KYBER_DISCARD] = 5 * NSEC_PER_SEC,
+	[KYBER_READ] = 2ULL * NSEC_PER_MSEC,
+	[KYBER_WRITE] = 10ULL * NSEC_PER_MSEC,
+	[KYBER_DISCARD] = 5ULL * NSEC_PER_SEC,
 };
 
 /*
Quoted 1 line

Jens, do you mind folding that in, or should I send it separately?

It's already applied, so please send it in separately. We only really need it for the last one, NSEC_PER_SEC, but I agree let's do all just in case it's changed later.

Signature · 1 line
Jens Axboe