summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2016-12-20 15:38:47 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2016-12-20 15:38:47 +0000
commitc866939fad12583300fd211e7892a28fb8971021 (patch)
treea92c36e4f51dd1b1005d37aae94337d93ab7268f /sbin
parentfe56bda1c7378899c129d983b7ad600bfc12f0e0 (diff)
This commit removes bio_status() calls after a BIOCLOCATE since the
bio status will never be updated on a BIOCLOCATE. In addition with missed zeroing of the passed bio struct, this could lead to a print of uninitialized memory. While there, properly zero the bio struct before passing it to ioctl(). ok mikeb@
Diffstat (limited to 'sbin')
-rw-r--r--sbin/bioctl/bioctl.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/sbin/bioctl/bioctl.c b/sbin/bioctl/bioctl.c
index aad5b965d66..49c48ca5730 100644
--- a/sbin/bioctl/bioctl.c
+++ b/sbin/bioctl/bioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bioctl.c,v 1.140 2016/10/20 07:14:44 tb Exp $ */
+/* $OpenBSD: bioctl.c,v 1.141 2016/12/20 15:38:46 patrick Exp $ */
/*
* Copyright (c) 2004, 2005 Marco Peereboom
@@ -231,13 +231,12 @@ main(int argc, char *argv[])
if (devh == -1)
err(1, "Can't open %s", "/dev/bio");
+ memset(&bl, 0, sizeof(bl));
bl.bl_name = devicename;
if (ioctl(devh, BIOCLOCATE, &bl))
errx(1, "Can't locate %s device via %s",
bl.bl_name, "/dev/bio");
- bio_status(&bl.bl_bio.bio_status);
-
bio_cookie = bl.bl_bio.bio_cookie;
biodev = 1;
devicename = NULL;
@@ -805,8 +804,6 @@ bio_blink(char *enclosure, int target, int blinktype)
bl.bl_name = enclosure;
if (ioctl(bioh, BIOCLOCATE, &bl))
errx(1, "Can't locate %s device via %s", enclosure, "/dev/bio");
-
- bio_status(&bl.bl_bio.bio_status);
memset(&blink, 0, sizeof(blink));
blink.bb_bio.bio_cookie = bio_cookie;