Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ata KASSERT if we attempt to access an invalid port.



details:   https://anonhg.NetBSD.org/src/rev/0100b755a042
branches:  trunk
changeset: 780400:0100b755a042
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Sun Jul 22 18:03:34 2012 +0000

description:
KASSERT if we attempt to access an invalid port.
Also, small whitespace change for internal consistency.

diffstat:

 sys/dev/ata/satapmp_subr.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (40 lines):

diff -r 06796c0fb724 -r 0100b755a042 sys/dev/ata/satapmp_subr.c
--- a/sys/dev/ata/satapmp_subr.c        Sun Jul 22 17:57:57 2012 +0000
+++ b/sys/dev/ata/satapmp_subr.c        Sun Jul 22 18:03:34 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: satapmp_subr.c,v 1.2 2012/07/15 10:55:29 dsl Exp $     */
+/*     $NetBSD: satapmp_subr.c,v 1.3 2012/07/22 18:03:34 jakllsch Exp $        */
 
 /*
  * Copyright (c) 2012 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: satapmp_subr.c,v 1.2 2012/07/15 10:55:29 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: satapmp_subr.c,v 1.3 2012/07/22 18:03:34 jakllsch Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -54,6 +54,7 @@
        struct atac_softc *atac = chp->ch_atac;
        struct ata_drive_datas *drvp;
 
+       KASSERT(port < PMP_MAX_DRIVES);
        KASSERT(reg < PMP_GSCR_NREGS);
        KASSERT(chp->ch_ndrives >= PMP_MAX_DRIVES);
        drvp = &chp->ch_drive[PMP_PORT_CTL];
@@ -99,12 +100,12 @@
        struct atac_softc *atac = chp->ch_atac;
        struct ata_drive_datas *drvp;
 
+       KASSERT(port < PMP_MAX_DRIVES);
        KASSERT(reg < PMP_GSCR_NREGS);
        KASSERT(chp->ch_ndrives >= PMP_MAX_DRIVES);
        drvp = &chp->ch_drive[PMP_PORT_CTL];
        KASSERT(drvp->drive == PMP_PORT_CTL);
 
-
        memset(&ata_c, 0, sizeof(struct ata_command));
 
        ata_c.r_command = PMPC_WRITE_PORT;



Home | Main Index | Thread Index | Old Index