Module Name:    src
Committed By:   jakllsch
Date:           Sun Jul 22 18:03:34 UTC 2012

Modified Files:
        src/sys/dev/ata: satapmp_subr.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ata/satapmp_subr.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/ata/satapmp_subr.c
diff -u src/sys/dev/ata/satapmp_subr.c:1.2 src/sys/dev/ata/satapmp_subr.c:1.3
--- src/sys/dev/ata/satapmp_subr.c:1.2	Sun Jul 15 10:55:29 2012
+++ src/sys/dev/ata/satapmp_subr.c	Sun Jul 22 18:03:34 2012
@@ -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 @@ satapmp_read(struct ata_channel *chp, in
 	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 @@ satapmp_write(struct ata_channel *chp, i
 	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;

Reply via email to