Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/scsipi Avoid null pointer deref in printing xfer mod...
details: https://anonhg.NetBSD.org/src/rev/5e82b98aeb9b
branches: trunk
changeset: 451007:5e82b98aeb9b
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Fri May 03 16:06:56 2019 +0000
description:
Avoid null pointer deref in printing xfer mode when no target driver
is attached. Fixes kern/54157.
diffstat:
sys/dev/scsipi/scsi_base.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diffs (37 lines):
diff -r ac74534ea74c -r 5e82b98aeb9b sys/dev/scsipi/scsi_base.c
--- a/sys/dev/scsipi/scsi_base.c Fri May 03 11:29:06 2019 +0000
+++ b/sys/dev/scsipi/scsi_base.c Fri May 03 16:06:56 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: scsi_base.c,v 1.92 2017/06/17 22:35:50 mlelstv Exp $ */
+/* $NetBSD: scsi_base.c,v 1.93 2019/05/03 16:06:56 mlelstv Exp $ */
/*-
* Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: scsi_base.c,v 1.92 2017/06/17 22:35:50 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsi_base.c,v 1.93 2019/05/03 16:06:56 mlelstv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -136,9 +136,17 @@
static void
scsi_print_xfer_mode(struct scsipi_periph *periph)
{
+ struct scsipi_channel *chan = periph->periph_channel;
+ struct scsipi_adapter *adapt = chan->chan_adapter;
int period, freq, speed, mbs;
- aprint_normal_dev(periph->periph_dev, "");
+ if (periph->periph_dev)
+ aprint_normal_dev(periph->periph_dev, "");
+ else
+ aprint_normal("probe(%s:%d:%d:%d): ",
+ device_xname(adapt->adapt_dev),
+ chan->chan_channel, periph->periph_target,
+ periph->periph_lun);
if (periph->periph_mode & (PERIPH_CAP_SYNC | PERIPH_CAP_DT)) {
period = scsipi_sync_factor_to_period(periph->periph_period);
aprint_normal("sync (%d.%02dns offset %d)",
Home |
Main Index |
Thread Index |
Old Index