Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/scsipi Don't probe beyond chan_ntargets in atapi_pro...



details:   https://anonhg.NetBSD.org/src/rev/6d349c63d7fc
branches:  trunk
changeset: 327348:6d349c63d7fc
user:      skrll <skrll%NetBSD.org@localhost>
date:      Wed Mar 05 08:45:13 2014 +0000

description:
Don't probe beyond chan_ntargets in atapi_probe_bus in the "all" case.

PR/48626: ahci_atapi_probe_device panic with kmemguard

diffstat:

 sys/dev/scsipi/atapiconf.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r e24f013c8bce -r 6d349c63d7fc sys/dev/scsipi/atapiconf.c
--- a/sys/dev/scsipi/atapiconf.c        Wed Mar 05 08:23:16 2014 +0000
+++ b/sys/dev/scsipi/atapiconf.c        Wed Mar 05 08:45:13 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atapiconf.c,v 1.86 2012/06/24 07:48:01 riastradh Exp $ */
+/*     $NetBSD: atapiconf.c,v 1.87 2014/03/05 08:45:13 skrll Exp $     */
 
 /*
  * Copyright (c) 1996, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: atapiconf.c,v 1.86 2012/06/24 07:48:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atapiconf.c,v 1.87 2014/03/05 08:45:13 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -231,8 +231,10 @@
        int error;
        struct atapi_adapter *atapi_adapter;
 
+       KASSERT(chan->chan_ntargets >= 1);
+
        if (target == -1) {
-               maxtarget = 1;
+               maxtarget = chan->chan_ntargets - 1;
                mintarget = 0;
        } else {
                if (target < 0 || target >= chan->chan_ntargets)



Home | Main Index | Thread Index | Old Index