Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/acpi Fix undefined behavior in thinkpad_mask_init()....



details:   https://anonhg.NetBSD.org/src/rev/c72e14e49703
branches:  trunk
changeset: 964496:c72e14e49703
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Mon Aug 05 10:09:35 2019 +0000

description:
Fix undefined behavior in thinkpad_mask_init(). Found by kUBSan.

diffstat:

 sys/dev/acpi/thinkpad_acpi.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 71448e298d64 -r c72e14e49703 sys/dev/acpi/thinkpad_acpi.c
--- a/sys/dev/acpi/thinkpad_acpi.c      Mon Aug 05 07:03:55 2019 +0000
+++ b/sys/dev/acpi/thinkpad_acpi.c      Mon Aug 05 10:09:35 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: thinkpad_acpi.c,v 1.46 2016/04/03 10:36:00 mlelstv Exp $ */
+/* $NetBSD: thinkpad_acpi.c,v 1.47 2019/08/05 10:09:35 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.46 2016/04/03 10:36:00 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.47 2019/08/05 10:09:35 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -565,7 +565,7 @@
 
        for (i = 0; i < 32; i++) {
                param[0].Integer.Value = i + 1;
-               param[1].Integer.Value = (((1 << i) & mask) != 0);
+               param[1].Integer.Value = ((__BIT(i) & mask) != 0);
 
                rv = AcpiEvaluateObject(sc->sc_node->ad_handle, "MHKM",
                    &params, NULL);



Home | Main Index | Thread Index | Old Index