Module Name:    src
Committed By:   martin
Date:           Fri Jun 22 15:52:00 UTC 2018

Modified Files:
        src/sys/dev/i2c: i2c.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/dev/i2c/i2c.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/i2c/i2c.c
diff -u src/sys/dev/i2c/i2c.c:1.63 src/sys/dev/i2c/i2c.c:1.64
--- src/sys/dev/i2c/i2c.c:1.63	Mon Jun 18 17:07:07 2018
+++ src/sys/dev/i2c/i2c.c	Fri Jun 22 15:52:00 2018
@@ -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 @@ iic_use_direct_match(const struct i2c_at
 	}
 
 	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;
 	}
 

Reply via email to