Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/scsipi the number of possible ATAPI devices on an AT...
details: https://anonhg.NetBSD.org/src/rev/6a5cfe19cbe0
branches: trunk
changeset: 744735:6a5cfe19cbe0
user: chs <chs%NetBSD.org@localhost>
date: Wed Feb 12 00:19:07 2020 +0000
description:
the number of possible ATAPI devices on an ATA bus is not always 2,
it is however many devices the underlying ATA bus can have (eg. 1 for SATA),
so initialize the scsipi chan_ntargets from the ATA ch_ndrives.
this fixes a memory read overrun detected by KASAN.
discussed with mlelstv@ and jdolecek@
diffstat:
sys/dev/scsipi/atapi_wdc.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diffs (27 lines):
diff -r ce12024cf356 -r 6a5cfe19cbe0 sys/dev/scsipi/atapi_wdc.c
--- a/sys/dev/scsipi/atapi_wdc.c Tue Feb 11 15:11:27 2020 +0000
+++ b/sys/dev/scsipi/atapi_wdc.c Wed Feb 12 00:19:07 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: atapi_wdc.c,v 1.134 2019/11/10 21:16:37 chs Exp $ */
+/* $NetBSD: atapi_wdc.c,v 1.135 2020/02/12 00:19:07 chs Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: atapi_wdc.c,v 1.134 2019/11/10 21:16:37 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atapi_wdc.c,v 1.135 2020/02/12 00:19:07 chs Exp $");
#ifndef ATADEBUG
#define ATADEBUG
@@ -138,7 +138,7 @@
chan->chan_flags = SCSIPI_CHAN_OPENINGS;
chan->chan_openings = 1;
chan->chan_max_periph = 1;
- chan->chan_ntargets = 2;
+ chan->chan_ntargets = chp->ch_ndrives;
chan->chan_nluns = 1;
chp->atapibus = config_found_ia(ata_sc->sc_dev, "atapi", chan,
Home |
Main Index |
Thread Index |
Old Index