Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/drm2/dist/drm/i915 Cast uint8_t to uint32_t...
details: https://anonhg.NetBSD.org/src/rev/b5c3773131ed
branches: trunk
changeset: 813756:b5c3773131ed
user: riastradh <riastradh%NetBSD.org@localhost>
date: Wed Feb 17 00:01:23 2016 +0000
description:
Cast uint8_t to uint32_t before shifting left by 24.
Otherwise this is undefined behaviour unless int is 32-bit and the
uint8_t value happens to be <=127.
diffstat:
sys/external/bsd/drm2/dist/drm/i915/intel_pm.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diffs (14 lines):
diff -r 9b791273743f -r b5c3773131ed sys/external/bsd/drm2/dist/drm/i915/intel_pm.c
--- a/sys/external/bsd/drm2/dist/drm/i915/intel_pm.c Tue Feb 16 23:07:58 2016 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/intel_pm.c Wed Feb 17 00:01:23 2016 +0000
@@ -4487,8 +4487,8 @@
pxw[15] = 0;
for (i = 0; i < 4; i++) {
- u32 val = (pxw[i*4] << 24) | (pxw[(i*4)+1] << 16) |
- (pxw[(i*4)+2] << 8) | (pxw[(i*4)+3]);
+ u32 val = ((u32)pxw[i*4] << 24) | ((u32)pxw[(i*4)+1] << 16) |
+ ((u32)pxw[(i*4)+2] << 8) | ((u32)pxw[(i*4)+3]);
I915_WRITE(PXW + (i * 4), val);
}
Home |
Main Index |
Thread Index |
Old Index