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/linux linux/hdmi: Zero entire union hd...



details:   https://anonhg.NetBSD.org/src/rev/9fc63c0d7612
branches:  trunk
changeset: 368403:9fc63c0d7612
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Jul 09 18:11:47 2022 +0000

description:
linux/hdmi: Zero entire union hdmi_infoframe on unpack.

Don't just zero the part that we're about to initialize -- i915 does
memcmp on the whole structure.

diffstat:

 sys/external/bsd/drm2/linux/linux_hdmi.c |  16 ++++------------
 1 files changed, 4 insertions(+), 12 deletions(-)

diffs (72 lines):

diff -r c2eda8067439 -r 9fc63c0d7612 sys/external/bsd/drm2/linux/linux_hdmi.c
--- a/sys/external/bsd/drm2/linux/linux_hdmi.c  Sat Jul 09 18:11:35 2022 +0000
+++ b/sys/external/bsd/drm2/linux/linux_hdmi.c  Sat Jul 09 18:11:47 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_hdmi.c,v 1.3 2022/07/09 18:11:36 riastradh Exp $ */
+/*     $NetBSD: linux_hdmi.c,v 1.4 2022/07/09 18:11:47 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_hdmi.c,v 1.3 2022/07/09 18:11:36 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_hdmi.c,v 1.4 2022/07/09 18:11:47 riastradh Exp $");
 
 #include <sys/types.h>
 
@@ -192,8 +192,6 @@
        const uint8_t *p = buf;
        int ret;
 
-       memset(frame, 0, sizeof(*frame));
-
        ret = hdmi_infoframe_header_unpack(&frame->header, p, size);
        if (ret)
                return ret;
@@ -302,8 +300,6 @@
        const uint8_t *p = buf;
        int ret;
 
-       memset(frame, 0, sizeof(*frame));
-
        ret = hdmi_infoframe_header_unpack(&frame->header, p, size);
        if (ret)
                return ret;
@@ -419,8 +415,6 @@
        unsigned i;
        int ret;
 
-       memset(frame, 0, sizeof(*frame));
-
        ret = hdmi_infoframe_header_unpack(&frame->header, p, size);
        if (ret)
                return ret;
@@ -512,8 +506,6 @@
        const uint8_t *p = buf;
        int ret;
 
-       memset(frame, 0, sizeof(*frame));
-
        ret = hdmi_infoframe_header_unpack(&frame->header, p, size);
        if (ret)
                return ret;
@@ -629,8 +621,6 @@
        const uint8_t *p = buf;
        int ret;
 
-       memset(frame, 0, sizeof(*frame));
-
        ret = hdmi_infoframe_header_unpack(&frame->header, p, size);
        if (ret)
                return ret;
@@ -702,6 +692,8 @@
        struct hdmi_infoframe_header header;
        int ret;
 
+       memset(frame, 0, sizeof(*frame));
+
        ret = hdmi_infoframe_header_unpack(&header, buf, size);
        if (ret)
                return ret;



Home | Main Index | Thread Index | Old Index