diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2009-09-13 19:21:43 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2009-09-13 19:21:43 +0000 |
commit | 93b46ed9d668274b7c21381abfcb0890ccc1f04b (patch) | |
tree | 3aaa50a7ed26f18b4bba9a787018c8db69380f94 | |
parent | 35aee04f0475c85fd9c845a9c3982043cd7b98a7 (diff) |
Unchecked copyout() calls cause premature death in furry animals, so
check their return values in the ATA_S_COMPLETE ioctl handler.
dlg@ agrees.
-rw-r--r-- | sys/dev/ata/atascsi.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/dev/ata/atascsi.c b/sys/dev/ata/atascsi.c index b82242f0d53..daaeef364dc 100644 --- a/sys/dev/ata/atascsi.c +++ b/sys/dev/ata/atascsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atascsi.c,v 1.64 2009/02/16 21:19:06 miod Exp $ */ +/* $OpenBSD: atascsi.c,v 1.65 2009/09/13 19:21:42 miod Exp $ */ /* * Copyright (c) 2007 David Gwynne <dlg@openbsd.org> @@ -880,6 +880,7 @@ atascsi_ioctl_cmd(struct atascsi *as, struct ata_port *ap, atareq_t *atareq) struct ata_xfer *xa; struct ata_fis_h2d *fis; void *buf; + int rc = 0; xa = ata_get_xfer(ap); if (xa == NULL) @@ -930,7 +931,7 @@ atascsi_ioctl_cmd(struct atascsi *as, struct ata_port *ap, atareq_t *atareq) case ATA_S_COMPLETE: atareq->retsts = ATACMD_OK; if (atareq->flags & ATACMD_READ) - copyout(buf, atareq->databuf, atareq->datalen); + rc = copyout(buf, atareq->databuf, atareq->datalen); break; case ATA_S_ERROR: atareq->retsts = ATACMD_ERROR; @@ -947,7 +948,7 @@ atascsi_ioctl_cmd(struct atascsi *as, struct ata_port *ap, atareq_t *atareq) ata_put_xfer(xa); - return (0); + return (rc); } void |