diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2009-09-06 20:32:02 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2009-09-06 20:32:02 +0000 |
commit | 8f1649586ccc62794e0840aa77c28fb4cd52d48e (patch) | |
tree | 291717b531e9a57ffe63004b6e571b192a62c473 /sys | |
parent | 2fd91aac38ea3f6322903b6921b4b83d15b292a9 (diff) |
Don't pass uninitialized stack memory to setdisklabel() as the 'old'
label. Use the existing label, since we now check and reuse some
values in it. And that's what all other drivers do. Bonus: we don't
need that label on the stack anymore.
ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/isa/fd.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/dev/isa/fd.c b/sys/dev/isa/fd.c index 4b3f1ed2d09..40a7ce7cc0d 100644 --- a/sys/dev/isa/fd.c +++ b/sys/dev/isa/fd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fd.c,v 1.81 2009/08/24 08:51:18 jasper Exp $ */ +/* $OpenBSD: fd.c,v 1.82 2009/09/06 20:32:01 krw Exp $ */ /* $NetBSD: fd.c,v 1.90 1996/05/12 23:12:03 mycroft Exp $ */ /*- @@ -1022,7 +1022,7 @@ fdioctl(dev, cmd, addr, flag, p) struct proc *p; { struct fd_softc *fd = fd_cd.cd_devs[FDUNIT(dev)]; - struct disklabel dl, *lp = &dl; + struct disklabel *lp; int error; switch (cmd) { @@ -1062,11 +1062,12 @@ fdioctl(dev, cmd, addr, flag, p) if ((flag & FWRITE) == 0) return EBADF; - error = setdisklabel(lp, (struct disklabel *)addr, 0); + error = setdisklabel(fd->sc_dk.dk_label, (struct disklabel *)addr, 0); if (error) return error; - error = writedisklabel(DISKLABELDEV(dev), fdstrategy, lp); + error = writedisklabel(DISKLABELDEV(dev), fdstrategy, + fd->sc_dk.dk_label); return error; case FD_FORM: |