Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/acpi acpi: /dev/acpi: fix bounds check when reading ...



details:   https://anonhg.NetBSD.org/src/rev/91f971f13cd2
branches:  trunk
changeset: 1022528:91f971f13cd2
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Jul 24 11:36:41 2021 +0000

description:
acpi: /dev/acpi: fix bounds check when reading tables

diffstat:

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

diffs (27 lines):

diff -r b32c7493ad59 -r 91f971f13cd2 sys/dev/acpi/acpi_dev.c
--- a/sys/dev/acpi/acpi_dev.c   Sat Jul 24 10:22:28 2021 +0000
+++ b/sys/dev/acpi/acpi_dev.c   Sat Jul 24 11:36:41 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_dev.c,v 1.1 2020/12/06 02:57:30 jmcneill Exp $ */
+/* $NetBSD: acpi_dev.c,v 1.2 2021/07/24 11:36:41 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_dev.c,v 1.1 2020/12/06 02:57:30 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_dev.c,v 1.2 2021/07/24 11:36:41 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -208,7 +208,7 @@
 
        /* Copy the contents of the table to user-space */
        pa = uio->uio_offset;
-       len = uimin(pa - table_pa + table_len, uio->uio_resid);
+       len = uimin(table_len - (pa - table_pa), uio->uio_resid);
        data = AcpiOsMapMemory(pa, len);
        if (data == NULL) {
                return ENOMEM;



Home | Main Index | Thread Index | Old Index