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 Do not meddle in the aff...



details:   https://anonhg.NetBSD.org/src/rev/69dada6cef7a
branches:  trunk
changeset: 364450:69dada6cef7a
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 27 07:28:57 2018 +0000

description:
Do not meddle in the affairs of strict aliasing,

for it is quick to anger and you are tasty with a bit of mustard on
your undefined behaviour.

diffstat:

 sys/external/bsd/drm2/dist/drm/i915/intel_psr.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (41 lines):

diff -r 8b399f3dd4cc -r 69dada6cef7a sys/external/bsd/drm2/dist/drm/i915/intel_psr.c
--- a/sys/external/bsd/drm2/dist/drm/i915/intel_psr.c   Mon Aug 27 07:28:41 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/intel_psr.c   Mon Aug 27 07:28:57 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intel_psr.c,v 1.4 2018/08/27 07:28:41 riastradh Exp $  */
+/*     $NetBSD: intel_psr.c,v 1.5 2018/08/27 07:28:57 riastradh Exp $  */
 
 /*
  * Copyright © 2014 Intel Corporation
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_psr.c,v 1.4 2018/08/27 07:28:41 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_psr.c,v 1.5 2018/08/27 07:28:57 riastradh Exp $");
 
 #include <drm/drmP.h>
 
@@ -86,7 +86,8 @@
        struct intel_crtc *crtc = to_intel_crtc(dig_port->base.base.crtc);
        enum transcoder cpu_transcoder = crtc->config->cpu_transcoder;
        u32 ctl_reg = HSW_TVIDEO_DIP_CTL(cpu_transcoder);
-       uint32_t *data = (uint32_t *) vsc_psr;
+       uint32_t data;
+       const char *ptr = (const char *)vsc_psr;
        unsigned int i;
 
        /* As per BSPec (Pipe Video Data Island Packet), we need to disable
@@ -96,9 +97,9 @@
        POSTING_READ(ctl_reg);
 
        for (i = 0; i < sizeof(*vsc_psr); i += 4) {
-               I915_WRITE(HSW_TVIDEO_DIP_VSC_DATA(cpu_transcoder,
-                                                  i >> 2), *data);
-               data++;
+               memcpy(&data, &ptr[i], 4);
+               I915_WRITE(HSW_TVIDEO_DIP_VSC_DATA(cpu_transcoder, i >> 2),
+                   data);
        }
        for (; i < VIDEO_DIP_VSC_DATA_SIZE; i += 4)
                I915_WRITE(HSW_TVIDEO_DIP_VSC_DATA(cpu_transcoder,



Home | Main Index | Thread Index | Old Index