Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/videomode Fix uninitialized variable. There may not ...



details:   https://anonhg.NetBSD.org/src/rev/73d05d8d8ae4
branches:  trunk
changeset: 848327:73d05d8d8ae4
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Jan 25 15:59:11 2020 +0000

description:
Fix uninitialized variable. There may not be a TYPE_ASCII block. Found by
kMSan with nouveau.

diffstat:

 sys/dev/videomode/edid.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (35 lines):

diff -r 116015327515 -r 73d05d8d8ae4 sys/dev/videomode/edid.c
--- a/sys/dev/videomode/edid.c  Sat Jan 25 15:55:33 2020 +0000
+++ b/sys/dev/videomode/edid.c  Sat Jan 25 15:59:11 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: edid.c,v 1.14 2018/07/10 01:44:30 macallan Exp $ */
+/* $NetBSD: edid.c,v 1.15 2020/01/25 15:59:11 maxv Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
  */ 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: edid.c,v 1.14 2018/07/10 01:44:30 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: edid.c,v 1.15 2020/01/25 15:59:11 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -467,6 +467,7 @@
                break;
 
        case EDID_DESC_BLOCK_TYPE_ASCII:
+               memset(edid->edid_comment, 0, sizeof(edid->edid_comment));
                memcpy(edid->edid_comment, data + EDID_DESC_ASCII_DATA_OFFSET,
                    EDID_DESC_ASCII_DATA_LEN);
                edid->edid_comment[sizeof(edid->edid_comment) - 1] = 0;
@@ -562,6 +563,8 @@
        snprintf(edid->edid_serial, sizeof(edid->edid_serial), "%08x",
            EDID_SERIAL_NUMBER(data));
 
+       edid->edid_comment[0] = '\0';
+
        edid->edid_week = EDID_WEEK(data);
        edid->edid_year = EDID_YEAR(data);
 



Home | Main Index | Thread Index | Old Index