Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/i2c iic_use_direct_match(): when iic_compatible_matc...



details:   https://anonhg.NetBSD.org/src/rev/c09b08d3af10
branches:  trunk
changeset: 320082:c09b08d3af10
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Jun 22 15:52:00 2018 +0000

description:
iic_use_direct_match(): when iic_compatible_match() does not find a
comptible entry, set match quality to 0. Otherwise callers might use
random stack garbage.

diffstat:

 sys/dev/i2c/i2c.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 9af539c7c859 -r c09b08d3af10 sys/dev/i2c/i2c.c
--- a/sys/dev/i2c/i2c.c Fri Jun 22 15:48:57 2018 +0000
+++ b/sys/dev/i2c/i2c.c Fri Jun 22 15:52:00 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i2c.c,v 1.63 2018/06/18 17:07:07 thorpej Exp $ */
+/*     $NetBSD: i2c.c,v 1.64 2018/06/22 15:52:00 martin Exp $  */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.63 2018/06/18 17:07:07 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.64 2018/06/22 15:52:00 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -735,7 +735,8 @@
        }
 
        if (ia->ia_ncompat > 0 && ia->ia_compat != NULL) {
-               (void) iic_compatible_match(ia, compats, match_resultp);
+               if (iic_compatible_match(ia, compats, match_resultp) == NULL)
+                       *match_resultp = 0;
                return true;
        }
 



Home | Main Index | Thread Index | Old Index