Skip to contentSkip to conversation

i915: Fix an overflow in __i915_wait_request

PATCH In review Alan 2 participants 2 messages Feb 17, 2016

Subsystems (2)
lore
Share & tools
lore

Alan

author
#0 lore raw

PATCH 1/1 i915: Fix an overflow in __i915_wait_request

The timeout is 64bit but the maths against it is done 32bit wrapped. Force 64bit.

---
 drivers/gpu/drm/i915/i915_gem.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +2 -2
index de57e7f..dc81045 100644
@@ -1358,9 +1358,9 @@ out:
 		 * bit of mismatch in the jiffies<->nsecs<->ktime loop. So patch
 		 * things up to make the test happy. We allow up to 1 jiffy.
 		 *
-		 * This is a regrssion from the timespec->ktime conversion.
+		 * This is a regression from the timespec->ktime conversion.
 		 */
-		if (ret == -ETIME && *timeout < jiffies_to_usecs(1)*1000)
+		if (ret == -ETIME && *timeout < jiffies_to_usecs(1)*1000ULL)
 			*timeout = 0;
 	}
 

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#1 lore raw
Quoted 2 lines · Alan

The timeout is 64bit but the maths against it is done 32bit wrapped. Force 64bit.

Where does this wrap? Iirc the lowest HZ we have is 100, and that should still comfortably fit into 32 bits. I assume this is due to some overenthusiastic static checker. If so ok if I adjust the commit message to make it clear it never wrapped, and we only shut up a real tool here?

Thanks, Daniel

Quoted 27 lines
---
 drivers/gpu/drm/i915/i915_gem.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +2 -2
index de57e7f..dc81045 100644
@@ -1358,9 +1358,9 @@ out:
 		 * bit of mismatch in the jiffies<->nsecs<->ktime loop. So patch
 		 * things up to make the test happy. We allow up to 1 jiffy.
 		 *
-		 * This is a regrssion from the timespec->ktime conversion.
+		 * This is a regression from the timespec->ktime conversion.
 		 */
-		if (ret == -ETIME && *timeout < jiffies_to_usecs(1)*1000)
+		if (ret == -ETIME && *timeout < jiffies_to_usecs(1)*1000ULL)
 			*timeout = 0;
 	}
 

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel