summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2009-10-27 11:24:21 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2009-10-27 11:24:21 +0000
commit34ff7f498a5299d74d66c38c418561db221c9689 (patch)
tree71afd68739cf352fa755f78f07c075e8b008a040 /sys
parent66100dc75f607b1572c328ff49be4eb4135f481e (diff)
Check return value of scsi_xs_get() in scsi_ioc_cmd() for NULL. It
may or may not be possible to get NULL these days, but paranoia and consistancy of usage are nice. Prompted by looking at PR#6247 from Steven Mestdagh. ok dlg@
Diffstat (limited to 'sys')
-rw-r--r--sys/scsi/scsi_ioctl.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/scsi/scsi_ioctl.c b/sys/scsi/scsi_ioctl.c
index 4fb9c06b3d4..f4974a71cf7 100644
--- a/sys/scsi/scsi_ioctl.c
+++ b/sys/scsi/scsi_ioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_ioctl.c,v 1.33 2009/10/12 12:04:11 dlg Exp $ */
+/* $OpenBSD: scsi_ioctl.c,v 1.34 2009/10/27 11:24:20 krw Exp $ */
/* $NetBSD: scsi_ioctl.c,v 1.23 1996/10/12 23:23:17 christos Exp $ */
/*
@@ -106,6 +106,8 @@ scsi_ioc_cmd(struct scsi_link *link, scsireq_t *screq)
return (EFAULT);
xs = scsi_xs_get(link, 0);
+ if (xs == NULL)
+ return (ENOMEM);
memcpy(xs->cmd, screq->cmd, screq->cmdlen);
xs->cmdlen = screq->cmdlen;