summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2006-07-22 18:25:42 +0000
committerkrw <krw@openbsd.org>2006-07-22 18:25:42 +0000
commita029c0e7a50450e21bd18b54fad84f431bfc85f8 (patch)
tree6c530aba62f1f2f994b94cbd627973fc0ebd234b
parentNuke SCSIFORCELUN* and friends. These were introduced as a safety (diff)
downloadwireguard-openbsd-a029c0e7a50450e21bd18b54fad84f431bfc85f8.tar.xz
wireguard-openbsd-a029c0e7a50450e21bd18b54fad84f431bfc85f8.zip
Allocate enough, and only enough, scsi_link pointers for the number of
LUNs the driver says targets could have. Don't unconditionally allocate 8. USB and ATAPI devices have fewer. Fibre Channel devices can have more.
-rw-r--r--sys/scsi/scsiconf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c
index dfcec389ef8..8e602244f8d 100644
--- a/sys/scsi/scsiconf.c
+++ b/sys/scsi/scsiconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsiconf.c,v 1.108 2006/07/22 18:03:07 krw Exp $ */
+/* $OpenBSD: scsiconf.c,v 1.109 2006/07/22 18:25:42 krw Exp $ */
/* $NetBSD: scsiconf.c,v 1.57 1996/05/02 01:09:01 neil Exp $ */
/*
@@ -141,7 +141,7 @@ scsibusattach(struct device *parent, struct device *self, void *aux)
sb->sc_link = malloc(nbytes, M_DEVBUF, M_NOWAIT);
if (sb->sc_link == NULL)
panic("scsibusattach: can't allocate target links");
- nbytes = 8 * sizeof(struct scsi_link *);
+ nbytes = sb->adapter_link->luns * sizeof(struct scsi_link *);
for (i = 0; i < sb->sc_buswidth; i++) {
sb->sc_link[i] = malloc(nbytes, M_DEVBUF, M_NOWAIT);
if (sb->sc_link[i] == NULL)