summaryrefslogtreecommitdiff
path: root/lib/igt_dummyload.c
diff options
context:
space:
mode:
authorChris Wilson <chris.p.wilson@intel.com>2021-06-21 12:59:21 +0200
committerZbigniew Kempczyński <zbigniew.kempczynski@intel.com>2021-06-22 05:03:05 +0200
commit66201524b4819c0abfb4b2387a40b83d86ba0096 (patch)
tree9f99e32acaad6f38aa9cc037a68931f9480119c0 /lib/igt_dummyload.c
parent4ef420186b82f1a6d9c9b69d2f8de4fd100a2af3 (diff)
lib: Beware implicit sign extension on large constants
(gdb) p/x (long long unsigned int)(1 << 31) $1 = 0xffffffff80000000 (gdb) p/x (long long unsigned int)(1u << 31) $2 = 0x80000000 The impact of this is that the random address we were placing the spinner at was always invalid on modern machines, causing the kernel to relocate the spinners wherever and thus undergoing relocations. Signed-off-by: Chris Wilson <chris.p.wilson@intel.com> Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Diffstat (limited to 'lib/igt_dummyload.c')
-rw-r--r--lib/igt_dummyload.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
index 82459e52..63b1fc73 100644
--- a/lib/igt_dummyload.c
+++ b/lib/igt_dummyload.c
@@ -119,7 +119,7 @@ emit_recursive_batch(igt_spin_t *spin,
*/
addr = gem_aperture_size(fd) / 2;
if (addr >> 31)
- addr = 1 << 31;
+ addr = 1u << 31;
addr += random() % addr / 2;
addr &= -4096;