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/8f7bcf96ccc1
branches:  trunk
changeset: 458639:8f7bcf96ccc1
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 2128462747ec -r 8f7bcf96ccc1 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