Module Name: src Committed By: kamil Date: Fri Feb 15 20:48:57 UTC 2019
Modified Files: src/sys/dev/acpi/acpica: OsdHardware.c Log Message: Avoid UB in OsdHardware.c UBSan: Undefined Behavior in src/sys/dev/acpi/acpica/OsdHardware.c:265:17, left shift of 255 by 24 places cannot be represented in type 'int' This file isn't part of upstream acpica so just fix it locally. Reported and initial patch by <Akul Pillai> To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/dev/acpi/acpica/OsdHardware.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/acpi/acpica/OsdHardware.c diff -u src/sys/dev/acpi/acpica/OsdHardware.c:1.10 src/sys/dev/acpi/acpica/OsdHardware.c:1.11 --- src/sys/dev/acpi/acpica/OsdHardware.c:1.10 Tue Jan 26 22:52:14 2016 +++ src/sys/dev/acpi/acpica/OsdHardware.c Fri Feb 15 20:48:57 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: OsdHardware.c,v 1.10 2016/01/26 22:52:14 christos Exp $ */ +/* $NetBSD: OsdHardware.c,v 1.11 2019/02/15 20:48:57 kamil Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -44,7 +44,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: OsdHardware.c,v 1.10 2016/01/26 22:52:14 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: OsdHardware.c,v 1.11 2019/02/15 20:48:57 kamil Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -262,13 +262,13 @@ AcpiOsWritePciConfiguration(ACPI_PCI_ID switch (Width) { case 8: tmp = pci_conf_read(pc, tag, Register & ~3); - tmp &= ~(0xff << ((Register & 3) * 8)); + tmp &= ~(0xffu << ((Register & 3) * 8)); tmp |= (Value << ((Register & 3) * 8)); break; case 16: tmp = pci_conf_read(pc, tag, Register & ~3); - tmp &= ~(0xffff << ((Register & 3) * 8)); + tmp &= ~(0xffffu << ((Register & 3) * 8)); tmp |= (Value << ((Register & 3) * 8)); break;