Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/acpi Bail if we have a zero-length memo...



details:   https://anonhg.NetBSD.org/src/rev/a83a93d54ef1
branches:  trunk
changeset: 318868:a83a93d54ef1
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Tue May 08 03:27:17 2018 +0000
description:
Bail if we have a zero-length memory resource.

diffstat:

 sys/dev/acpi/sdhc_acpi.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r a00b08395edf -r a83a93d54ef1 sys/dev/acpi/sdhc_acpi.c
--- a/sys/dev/acpi/sdhc_acpi.c  Tue May 08 01:02:38 2018 +0000
+++ b/sys/dev/acpi/sdhc_acpi.c  Tue May 08 03:27:17 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sdhc_acpi.c,v 1.4 2017/02/17 10:51:48 nonaka Exp $     */
+/*     $NetBSD: sdhc_acpi.c,v 1.5 2018/05/08 03:27:17 mlelstv Exp $    */
 
 /*
  * Copyright (c) 2016 Kimihiro Nonaka <nonaka%NetBSD.org@localhost>
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sdhc_acpi.c,v 1.4 2017/02/17 10:51:48 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc_acpi.c,v 1.5 2018/05/08 03:27:17 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -168,6 +168,10 @@
                aprint_error_dev(self, "incomplete resources\n");
                goto cleanup;
        }
+       if (mem->ar_length == 0) {
+               aprint_error_dev(self, "zero length memory resource\n");
+               goto cleanup;
+       }
        sc->sc_memsize = mem->ar_length;
 
        if (bus_space_map(sc->sc_memt, mem->ar_base, sc->sc_memsize, 0,



Home | Main Index | Thread Index | Old Index